Thanks Jason, mvn install is working for me, and thats an ok workaround for
now. It would be nice to have testCompile working too, but for now I have my
Groovy unit tests running in my build, so that's great.

cheers
David

On 3/18/07, Jason Dillon <[EMAIL PROTECTED]> wrote:

So... this problem seems to only show up when you:
    mvn groovy:testCompile

Does not seem to have any problems if you simply:

    mvn install

The later is actually what I recommend doing anyways.  When you rung the
goal on the command-line like this you won't get any of the configuration
picked up in the execution/configuration block which you have defined.
Granted the settings you have there are the defaults, but if you wanted to
add any other configuration, then you would have to move them to the
plugin/configuration element.

I'm not really sure why when running the goal by itself is not getting the
dependencies defined in the pom configured.   I can probably dig into that a
little more and find out why.

The simpletest1 project is already configured to properly invoke
groovy:testCompile during the test-compile phase, so I recommend that you
specify a phase (like package or install) on the command-line to build this
project.

--jason


On Mar 18, 2007, at 9:50 AM, David Black wrote:

It is pretty much the same sample module. In fact, I am still getting the
failure the resolve junit when I attempt to import it, and also the failure
to resolve GroovyTestCase. I've attached the project - I have updated it to
use the alpha-2 snapshot plugin.

Full output of a groovy:testCompile run:

C:\Source\codecurl\workspaces\codecurl\simpletest1>mvn -e
groovy:testCompile
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'groovy'.
[INFO]
-------------------------------------------------------------------------
---
[INFO] Building Unnamed - foo:foo:jar:0.0.1
[INFO]    task-segment: [groovy:testCompile]
[INFO]
-------------------------------------------------------------------------
---
Downloading:
http://repository.codehaus.org/groovy/groovy-all/1.0/groovy-all-1.0
.pom
[WARNING] Unable to get resource 'groovy:groovy-all:pom: 1.0' from
repository cod
ehaus.org (http://repository.codehaus.org)
Downloading:
http://repo1.maven.org/maven2/groovy/groovy-all/1.0/groovy-all-1.0.
pom
[WARNING] Unable to get resource 'groovy:groovy-all:pom:1.0' from
repository cen
tral (http://repo1.maven.org/maven2 )
Downloading:
http://repo1.maven.org/maven2/groovy/groovy-all/1.0/groovy-all-1.0.
pom
[WARNING] Unable to get resource 'groovy:groovy-all:pom: 1.0' from
repository cen
tral (http://repo1.maven.org/maven2)
[INFO] [groovy:testCompile]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] startup failed,
C:\Source\codecurl\workspaces\codecurl\simpletest1\src\te
st\groovy\foo\BarTest.groovy: 3: unable to resolve class
junit.framework.TestCas
e
 @ line 3, column 1.
   import junit.framework.TestCase;
   ^

C:\Source\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.g
roovy: 5: unable to resolve class GroovyTestCase
 @ line 5, column 1.
   class BarTest extends GroovyTestCase {
   ^

2 errors


[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException : startup failed,
C:\Sourc
e\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.groovy:
3
: unable to resolve class junit.framework.TestCase
 @ line 3, column 1.
   import junit.framework.TestCase ;
   ^

C:\Source\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.g
roovy: 5: unable to resolve class GroovyTestCase
 @ line 5, column 1.
   class BarTest extends GroovyTestCase {
   ^

2 errors

        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:564)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(Defau
ltLifecycleExecutor.java:463)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
        at org.codehaus.classworlds.Launcher.launch (Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(
Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException : startup
failed, C:\So

urce\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.groovy
: 3: unable to resolve class junit.framework.TestCase
 @ line 3, column 1.
   import junit.framework.TestCase ;
   ^

C:\Source\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.g
roovy: 5: unable to resolve class GroovyTestCase
 @ line 5, column 1.
   class BarTest extends GroovyTestCase {
   ^

2 errors

        at org.codehaus.mojo.pluginsupport.MojoSupport.execute(
MojoSupport.java:
137)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPlugi
nManager.java:420)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
        ... 16 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException:
start
up failed,
C:\Source\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\fo
o\BarTest.groovy: 3: unable to resolve class junit.framework.TestCase
 @ line 3, column 1.
   import junit.framework.TestCase;
   ^

C:\Source\codecurl\workspaces\codecurl\simpletest1\src\test\groovy\foo\BarTest.g
roovy: 5: unable to resolve class GroovyTestCase
 @ line 5, column 1.
   class BarTest extends GroovyTestCase {
   ^

2 errors

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors
(ErrorCollecto
r.java:326)
        at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits
(Compil
ationUnit.java:848)
        at org.codehaus.groovy.control.CompilationUnit.compile(
CompilationUnit.j
ava:480)
        at org.codehaus.groovy.control.CompilationUnit.compile(
CompilationUnit.j
ava:459)
        at org.codehaus.mojo.groovy.CompilationMojoSupport.compile(CompilationMo
joSupport.java:250)
        at org.codehaus.mojo.groovy.CompilationMojoSupport.doExecute
(Compilation
MojoSupport.java:258)
        at org.codehaus.mojo.pluginsupport.MojoSupport.execute(
MojoSupport.java :
122)
        ... 18 more

On 3/17/07, Jason Dillon <[EMAIL PROTECTED]> wrote:
>
> On Mar 17, 2007, at 3:19 AM, David Black wrote:
>
> Ok, great, progress but I'm not quite there yet. Using the new alpha-2
> snapshot, I no longer get the unable to resolve junit error. However, with
> the test project I am now getting unable to resolve GroovyTestCase! :-( Is
> it just groovy-all I need in my dependency list? I've checked my groovy-all
> jar and GroovyTestCase is there ...
>
>
> What?  Is it the same sample module?
>
> If you still have problems... then send me another small module that
> shows the problem and I'll look into it more.
>
> --jason
>
>
> thanks for the quick turnaround
> David
>
> On 3/17/07, Jason Dillon <[EMAIL PROTECTED]> wrote:
> >
> > Aight, I've fixed this.  The classloader for compilation
> > (groovy:compile and groovy:testCompile) is now much, much cleaner... only
> > including the system classloader and the given classpath elements (from
> > project/dependencies and configuration/classpath if given).
> > I've just deployed a new 1.0-alpha-2-SNAPSHOT which has this fix.
> > Please give it a try and let me know if you still see any problems.
> >
> >  * * *
> > I have a feeling that similar problems may also occur with
> > groovy:execute.  I've already had to include the ant:ant* artifacts on the
> > plugin's classpath so that AntBuilders can be used.  I'm not sure what else
> > might break because of this at the moment.  But, gut tells me that I
> > probably have to fix the groovy:execute classloader stuff in the same way.
> >
> > I'm also considering adding an option which will dynamically add
> > things like groovy:groovy-all and ant:ant to the classpath, unless asked not
> > to... though I'm not sure if that is a good idea or not at the moment.  So
> > for now, you *must* add any groovy stuff (and deps of that groovy stuff) to
> > the classpath when using groovy:compile or groovy:testCompile... but for
> > groovy:execute those are added already.
> >
> > If anyone has any examples of groovy:execute which is failing because
> > some groovy class can't resolve some class in a dependency/classpath
> > element, please let me know so I can add a test case for it and fix it too
> > ;-)
> >
> > Cheers,
> >
> > --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
> >
> >
> >
>
>
<simpletest1.zip>
---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



Reply via email to