Java Builders on src/test/resources folders throwing NPE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Java Builders on src/test/resources folders throwing NPE

Harshad Penkar
This post has NOT been accepted by the mailing list yet.
I had posted my problem on gradle forum but Peter suggested I try Groovy-Eclipse forum.
Preventing compilation of .gradle files under 'src/test/resources'

In my project, I have a testdata folder defined under 'src/test/resources'. There are 2 folders under testdata containing deploy.gradle files separately and it appears that even after specifying them as Groovy scripts they are being picked up for compilation. The exception that I get:


Errors running builder 'Java Builder' on project 'TestProject'.

java.lang.NullPointerException
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.toRawType(JDTClassNodeBuilder.java:116)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.configureParameterizedType(JDTClassNodeBuilder.java:294)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.configureType(JDTClassNodeBuilder.java:56)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.createJDTClassNode(JDTResolver.java:470)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.convertToClassNode(JDTResolver.java:449)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize(JDTClassNode.java:216)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit(JDTClassNode.java:158)
        at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:958)
        at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:973)
        at org.codehaus.groovy.ast.ClassNode.hasPossibleStaticMethod(ClassNode.java:1417)
        at org.codehaus.groovy.control.StaticImportVisitor.findStaticMethod(StaticImportVisitor.java:532)
        at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessorByFullName(StaticImportVisitor.java:518)
        at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessor(StaticImportVisitor.java:489)
        at org.codehaus.groovy.control.StaticImportVisitor.findStaticFieldOrPropAccessorImportFromModule(StaticImportVisitor.java:385)
        at org.codehaus.groovy.control.StaticImportVisitor.transformVariableExpression(StaticImportVisitor.java:172)
        at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:73)
        at org.codehaus.groovy.ast.expr.Expression.transformExpressions(Expression.java:49)
        at org.codehaus.groovy.ast.expr.ArgumentListExpression.transformExpression(ArgumentListExpression.java:67)
        at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:91)
        at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:231)
        at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:82)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:179)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:102)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:113)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:50)
        at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:58)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:124)
        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1181)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:51)
        at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:52)
        at org.codehaus.groovy.control.CompilationUnit$2.call(CompilationUnit.java:686)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1138)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:610)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:588)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:565)
        at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:171)
        at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.resolve(GroovyCompilationUnitDeclaration.java:2015)
        at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:827)
        at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
        at java.lang.Thread.run(Thread.java:662)

I have enabled script folder under Groovy compiler as:
src/test/resources/**/*.gradle

How do I treat these .gradle files as scripts to be copied to the output folder without being compiled. Is there any way to avoid this exception?

Thanks,
-Harshad.