Help needed with Groovy + Maven + JUnit 4

View: New views
3 Messages — Rating Filter:   Alert me  

Help needed with Groovy + Maven + JUnit 4

by akoller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I'm having trouble getting JUnit 4 test cases written in Groovy to work in Maven. With the attached POM file and Groovy test case file (which I put in "src/test/groovy/GroovyTestTest.groovy"), I get the Maven output shown below. I have attached the test report; it involves a "java.lang.IllegalAccessError: tried to access field org.codehaus.groovy.reflection.CachedClass.EMPTY".

This is with Maven 2.1.0 on Java 5 on MacOS.

Can anyone help?

Thanks!

Cheers,
  Alexander.



gauss:groovytestproject koller$ mvn clean test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building groovytestproject
[INFO]    task-segment: [clean, test]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /Users/koller/Documents/nb-workspace/groovytestproject/target
[INFO] [resources:resources]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/koller/Documents/nb-workspace/groovytestproject/src/main/resources
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [groovy:generateTestStubs {execution: default}]
[INFO]  Generated 1 Java stub
[INFO] [resources:testResources]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/koller/Documents/nb-workspace/groovytestproject/src/test/resources
[INFO] [compiler:testCompile]
[INFO] Compiling 1 source file to /Users/koller/Documents/nb-workspace/groovytestproject/target/test-classes
[INFO] [groovy:testCompile {execution: default}]
[INFO]  Compiled 1 Groovy class
[INFO] [surefire:test]
[INFO] Surefire report directory: /Users/koller/Documents/nb-workspace/groovytestproject/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running GroovyTestTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.063 sec <<< FAILURE!

Results :

Tests in error:
  test1(GroovyTestTest)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.




GroovyTestTest.groovy
pom.xml
GroovyTestTest.txt

Re: Help needed with Groovy + Maven + JUnit 4

by akoller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I just found the answer to this. After playing around with the pom file, it turned out that the correct configuration is to _not_ have a dependency to gmaven-mojo. I included it because it appears in the example on http://groovy.codehaus.org/GMaven+-+1.0-rc-5+Release. Perhaps the documentation could be clarified.

Cheers,
  Alexander.



Re: Help needed with Groovy + Maven + JUnit 4

by bootz15 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the tip! I agree - I love GMaven!! But the documentation lags just a little, in sometimes frustrating ways.

On Sat, May 30, 2009 at 5:46 AM, akoller <akoller@...> wrote:

Ok, I just found the answer to this. After playing around with the pom file,
it turned out that the correct configuration is to _not_ have a dependency
to gmaven-mojo. I included it because it appears in the example on
http://groovy.codehaus.org/GMaven+-+1.0-rc-5+Release. Perhaps the
documentation could be clarified.

Cheers,
 Alexander.



--
View this message in context: http://www.nabble.com/Help-needed-with-Groovy-%2B-Maven-%2B-JUnit-4-tp23791023p23792648.html
Sent from the groovy - user mailing list archive at Nabble.com.


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

   http://xircles.codehaus.org/manage_email