Russel Winder wrote:
Trying to update the Gradle build of Groovy -- to make sure the
dependencies agree in build.gradle with pom.xml.

If I don't specify a version of Groovy in the dependencies, I get:

        :compile
        :: resolving dependencies ::
        org.codehaus.groovy#Trunk;1.7-beta-1-SNAPSHOT
                confs: [compile]
                found antlr#antlr;2.7.7 in clientModuleChain
                found asm#asm;2.2.3 in clientModuleChain
                found asm#asm-util;2.2.3 in clientModuleChain
                found asm#asm-analysis;2.2.3 in clientModuleChain
                found asm#asm-tree;2.2.3 in clientModuleChain
                found junit#junit;4.5 in clientModuleChain
                found commons-cli#commons-cli;1.2 in clientModuleChain
                found org.apache.ant#ant;1.7.1 in clientModuleChain
                found bsf#bsf;2.4.0 in MavenRepo
                found javax.servlet#servlet-api;2.4 in clientModuleChain
                found javax.servlet#jsp-api;2.0 in clientModuleChain
                found com.thoughtworks.xstream#xstream;1.3 in MavenRepo
                found jline#jline;0.9.94 in clientModuleChain
                found org.apache.ivy#ivy;2.0.0 in clientModuleChain
        :: resolution report :: resolve 1428ms :: artifacts dl 218ms
                
---------------------------------------------------------------------
                |                  |            modules            ||
        artifacts   |
                |       conf       | number| search|dwnlded|evicted|| number|
        dwnlded|
                
---------------------------------------------------------------------
                |      compile     |   14  |   0   |   0   |   0   ||   14  |
        0   |
                
---------------------------------------------------------------------
        :: resolving dependencies ::
        org.codehaus.groovy#Trunk;1.7-beta-1-SNAPSHOT
                confs: [groovy]
        :: resolution report :: resolve 16ms :: artifacts dl 0ms
                
---------------------------------------------------------------------
                |                  |            modules            ||
        artifacts   |
                |       conf       | number| search|dwnlded|evicted|| number|
        dwnlded|
                
---------------------------------------------------------------------
                |      groovy      |   0   |   0   |   0   |   0   ||   0   |
        0   |
                
---------------------------------------------------------------------
        [ant:mkdir] Created
        dir: 
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/build/classes
        [ant:groovyc] Compiling 312 source files
        to 
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/build/classes
        Exception in thread "main" java.lang.NoClassDefFoundError:
        org/codehaus/groovy/ant/Groovyc
        Caused by: java.lang.ClassNotFoundException:
        org.codehaus.groovy.ant.Groovyc
                at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                at sun.misc.Launcher
        $AppClassLoader.loadClass(Launcher.java:301)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
                at
        java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        Could not find the main class: org.codehaus.groovy.ant.Groovyc.
        Program will exit.

This is Gradle telling you that you haven't specified a version of Groovy. We (obviously) need to make this behaviour better, either with a more informative error message, or by defaulting to a particular Groovy version, or figuring out the version based on what's in your compile classpath.

If I specify groovy by:

        groovy ( 'org.codehaus.groovy:groovy-all:1.6.0' )

then I get:

        :compile
        :: resolving dependencies :: 
org.codehaus.groovy#Trunk;1.7-beta-1-SNAPSHOT
                confs: [compile]
                found org.codehaus.groovy#groovy-all;1.6.0 in clientModuleChain
                found antlr#antlr;2.7.7 in clientModuleChain
                found asm#asm;2.2.3 in clientModuleChain
                found asm#asm-util;2.2.3 in clientModuleChain
                found asm#asm-analysis;2.2.3 in clientModuleChain
                found asm#asm-tree;2.2.3 in clientModuleChain
                found junit#junit;4.5 in clientModuleChain
                found commons-cli#commons-cli;1.2 in clientModuleChain
                found org.apache.ant#ant;1.7.1 in clientModuleChain
                found bsf#bsf;2.4.0 in MavenRepo
                found javax.servlet#servlet-api;2.4 in clientModuleChain
                found javax.servlet#jsp-api;2.0 in clientModuleChain
                found com.thoughtworks.xstream#xstream;1.3 in MavenRepo
                found jline#jline;0.9.94 in clientModuleChain
                found org.apache.ivy#ivy;2.0.0 in clientModuleChain
        :: resolution report :: resolve 1486ms :: artifacts dl 67ms
                
---------------------------------------------------------------------
                |                  |            modules            ||   
artifacts   |
                |       conf       | number| search|dwnlded|evicted|| 
number|dwnlded|
                
---------------------------------------------------------------------
                |      compile     |   15  |   0   |   0   |   0   ||   15  |   
0   |
                
---------------------------------------------------------------------
        :: resolving dependencies :: 
org.codehaus.groovy#Trunk;1.7-beta-1-SNAPSHOT
                confs: [groovy]
                found org.codehaus.groovy#groovy-all;1.6.0 in clientModuleChain
        :: resolution report :: resolve 127ms :: artifacts dl 2ms
                
---------------------------------------------------------------------
                |                  |            modules            ||   
artifacts   |
                |       conf       | number| search|dwnlded|evicted|| 
number|dwnlded|
                
---------------------------------------------------------------------
                |      groovy      |   1   |   0   |   0   |   0   ||   1   |   
0   |
                
---------------------------------------------------------------------
        [ant:mkdir] Created dir: 
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/build/classes
        [ant:groovyc] Compiling 312 source files to 
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/build/classes
        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
failed, Compile error during compilation with javac.
        
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/src/main/groovy/lang/MetaClassImpl.java:2542:
 <anonymous groovy.lang.MetaClassImpl$12> is not abstract and does not override 
abstract method 
call(groovyjarjarasm.asm.ClassVisitor,org.codehaus.groovy.ast.ClassNode) in 
org.codehaus.groovy.control.CompilationUnit.ClassgenCallback
                            CompilationUnit.ClassgenCallback search = new 
CompilationUnit.ClassgenCallback() {
                                                                                
                             ^
        
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/src/main/groovy/lang/ExpandoMetaClass.java:812:
 cannot find symbol
        symbol  : constructor 
ClosureStaticMetaMethod(java.lang.String,java.lang.Class,groovy.lang.Closure,java.lang.Class[])
        location: class 
org.codehaus.groovy.runtime.metaclass.ClosureStaticMetaMethod
                                metaMethod = new 
ClosureStaticMetaMethod(methodName, theClass, callable, paramTypes);
                                             ^
        
/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/src/main/groovy/lang/GroovyClassLoader.java:429:
 groovy.lang.GroovyClassLoader.ClassCollector is not abstract and does not 
override abstract method 
call(groovyjarjarasm.asm.ClassVisitor,org.codehaus.groovy.ast.ClassNode) in 
org.codehaus.groovy.control.CompilationUnit.ClassgenCallback
            public static class ClassCollector extends 
CompilationUnit.ClassgenCallback {
                          ^
        Note: Some input files use unchecked or unsafe operations.
        Note: Recompile with -Xlint:unchecked for details.
        3 errors
1 error Build failed with an exception.
        Run with -s or -d option to get more details. Run with -f option to get 
the full (very verbose) stacktrace.
Build file '/home/users/russel/Repositories/Bazaar/Subversion/GroovyCore/Trunk/build.gradle' Execution failed for task ':compile'.
        Cause: Forked groovyc returned error code: 1
BUILD FAILED Total time: 17.082 secs


Just a guess, but this looks like the groovy 1.6 classes are ending up in the compile classpath, and are being picked up by the compiler in preference to the source. Which means if the classes have changed in 1.7, then you will see errors like the above.

Some things to try in your build file (I've not tested these):

- Change the 'compile' configuration to not extend from the 'groovy' configuration:

dependencies {
   compile.extendsFrom = [] as Set
}

- Tell the compiler to prefer source of classes:

compile.options.forkOptions.jvmargs = ['-Xprefer:source']


Adam


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to