Diagnosing the following problem took way too long: the documented
useManifestOnlyJar
property of the surefire plugin does not work in surefire 2.4.2, which is what my install of Maven2 picked up by by default. Since there are some potentially confusing interaction between surefire configuration properties, I include here the entire block you will need in your pom.xml to use "plain old Java class paths":
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<forkMode>once</forkMode>
<useManifestOnlyJar>false</useManifestOnlyJar>
<useSystemClassLoader>true</useSystemClassLoader>
</configuration>
</plugin>
...
</plugins>
<build>
In this case, I ran maven with maximal verbosity (
mvn -X test [yadda yadda]
) and eventually noticed:[DEBUG] (f) useSystemClassLoader = true...but no line talking about
useManifestOnlyJar
. Did I spell it wrong? Is it not recognized? Is it a surefire bug? (yes.)Now that I have the classpath working, the next step is to figure out why
useSystemClassLoader
is being ignored. What?System.out.println("CL: " + this.getClass().getClassLoader().toString());says:
Running com.kabira.iotest.AddressTest
CL: org.apache.maven.surefire.booter.IsolatedClassLoader@7051630a
Sigh.
Documentation for surefire plugin is here.