Aight... I can at least reproduce this now :-)

The reason my test-compile module works, and yours doesn't is because you are extending from groovy.util.GroovyTestCase and I am extending from junit.framework.TestCase.

Something is screwy with the class-path specifically with how groovy- all-1.0.jar bits get access to other classes which are loaded from classloaders which are peers.

This is because there is already a groovy-all-1.0.jar on the plugins classpath (and no junit) and the Groovy compiler is probably finding the GroovyTestCase class on its own classpath and just using it instead of asking the GCL's parent (which is where the the URL[] based classpath is).

Right now I'm using new GroovyClassLoader(ClassLoader), may need to use GroovyClassLoader(ClassLoader, CompilerConfiguration, true)...

Looking into this more... thanks for the testcase module... that really helped! Once I get this fixed I'm going to commit this to the src/it tests too.

--jason


On Mar 16, 2007, at 12:52 PM, David Black wrote:

Thanks for the response Jason. I'm attaching a simple test project which fails with this error on my system.

Just to be clear, I'm using maven 2.0.5, JDK 1.5.0_09, and I'm doing a

mvn groovy:testCompile

at the command line.

Let me know if I can provide any more info.

David

On 3/16/07, Jason Dillon < [EMAIL PROTECTED]> wrote:
This is the second time I've heard of this... but I still can not reproduce this problem.

Can you (or someone else) who is seeing this problem, please make a simple test module (including the test srcs) that cause this exception to pop up?

If so I can debug it... but as right now I can not reproduce this problem. The test-compile integration test seems to be working just fine:

http://svn.codehaus.org/mojo/trunk/mojo/groovy-maven-plugin/src/ it/test-compile/

--jason


On Mar 16, 2007, at 5:26 AM, David Black wrote:

Hi,

I'm  trying to use the groovy-maven plugin. This is my configuration:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <fileset>
<directory>${pom.basedir}/src/ test/groovy</directory>
                                    <includes>
<include>**/*.groovy</ include>
                                    </includes>
                                </fileset>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I have these 2 dependencies:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>1.0</version>
            <scope>test</scope>
        </dependency>

I have a really simple test which extends GroovyTestCase. Using the goal groovy:testCompile I get this error:

java.lang.NoClassDefFoundError : junit/framework/TestCase
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java :12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java: 260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java :195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassL
oader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass (DefaultClassReal
m.java:255)
at org.codehaus.classworlds.RealmClassLoader.loadClass (RealmClassLoader.
java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at groovy.lang.GroovyClassLoader.loadClass (GroovyClassLoader.java:643) at groovy.lang.GroovyClassLoader.loadClass (GroovyClassLoader.java:504) at org.codehaus.groovy.control.ResolveVisitor.resolveToClass(ResolveVisi
tor.java:506)
etc.

junit and groovy-all are in my repository. I've tried various things like removing scope=test, explicity importing junit.framework.TestCase into the Groovy test, just keep getting this same error.

Does anyone have an open source project with this working I could look at?

any help much appreciated

David Black
http://www.codecurl.org



<simpletest1.zip>
---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


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

   http://xircles.codehaus.org/manage_email

Reply via email to