Remove @GrabResolvers before packaging jar in CLI
Since all dependencies are local in a jar there is no need for a GrabResolver (and it breaks the app because the default ivy GrapeEngine is used instead of the smart, pretty Boot one). Fixes gh-1179
This commit is contained in:
@@ -35,6 +35,7 @@ import joptsimple.OptionSet;
|
||||
import joptsimple.OptionSpec;
|
||||
|
||||
import org.codehaus.groovy.ast.ASTNode;
|
||||
import org.codehaus.groovy.ast.AnnotatedNode;
|
||||
import org.codehaus.groovy.ast.AnnotationNode;
|
||||
import org.codehaus.groovy.ast.ClassNode;
|
||||
import org.codehaus.groovy.ast.ModuleNode;
|
||||
@@ -279,6 +280,21 @@ public class JarCommand extends OptionParsingCommand {
|
||||
// We only need to do it at most once
|
||||
break;
|
||||
}
|
||||
// Remove GrabReolvers because all the dependencies are local now
|
||||
removeGrabResolver(module.getClasses());
|
||||
removeGrabResolver(module.getImports());
|
||||
}
|
||||
|
||||
private void removeGrabResolver(List<? extends AnnotatedNode> nodes) {
|
||||
for (AnnotatedNode classNode : nodes) {
|
||||
List<AnnotationNode> annotations = classNode.getAnnotations();
|
||||
for (AnnotationNode node : new ArrayList<AnnotationNode>(annotations)) {
|
||||
if (node.getClassNode().getNameWithoutPackage()
|
||||
.equals("GrabResolver")) {
|
||||
annotations.remove(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user