Classpath conflicts running Groovy based unit tests.

I need a way to deal with classpath conflicts when running Groovy based unit tests from IDEA. Basically my problem results from a conflict between the asm-2.2.jar included in Groovy and the asm-1.5.3.jar needed by our project. IDEA puts all the groovy jars first in the classpath thus using the asm-2.2.jar in our code. There was an incompatible change made to the call list of the method org.objectweb.asm.ClassVistor which breaks Spring.

I can run these tests from the command line using Maven 1 or 2 because Maven is configured to use the groovy-all-1.5.0.jar which is designed to be embeddable to precisely avoid these version conflicts.

I see two possible solutions: Use the groovy-all-1.5.0.jar when running Groovy from IDEA (preferable) or put the Groovy jars last in the classpath.

I ran a test whereby I copied the command line that IDEA generated into a shell script which I then edited to use the groovy-all-1.5.0.jar instead of all the jars in the groovy/lib directory. The test runs then.

Any comments?

Edited by: Erik Husby on Apr 10, 2008 10:40 AM

2 comments
Comment actions Permalink

Yep, I known peoblem that was fixed some time ago. In latest JetGroovy version GROOVY lib is configured to use groovy-all.jar. Just reconfigure your groovy installation, or modify GROOVY library's classes manually.

0
Comment actions Permalink

Thanks, the key was reconfiguring the Global GROOY library -- I'd forgotten that.

0

Please sign in to leave a comment.