Show me the code! – By Davanum Srinivas

April 15, 2008

Tip for running Maven2 using Apache Harmony

Filed under: Uncategorized — Davanum Srinivas @ 3:33 pm

Just set JAVA_HOME as usual and run “mvn clean install”. But there’s a gotcha. You may see the following issue when surefire tries to run the tests.


[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Compiling 58 source files to /home/dims/XmlSchema/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: /home/dims/XmlSchema/target/surefire-reports
Uncaught exception in main:
java.lang.ClassNotFoundException: org.apache.maven.surefire.booter.SurefireBooter
at java.net.URLClassLoader.findClass(URLClassLoader.java:894)
at java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:981)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at org.apache.harmony.vm.JarRunner.main(JarRunner.java:72)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

If you do, then just set your MAVEN_OPTS as follows and run “mvn clean install” again.


set MAVEN_OPTS=-Dsurefire.useSystemClassLoader=false

More information about this switch can be found at:
http://docs.codehaus.org/display/MAVENUSER/Classloading+and+Forking+under+Maven+Surefire

1 Comment »

  1. Davanum,
    nice to see some online sign of life from you again.
    Hope you had a good start at big blue.

    Cheers,
    Jörg

    Comment by Jörg Buchberger — April 17, 2008 @ 1:58 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: