I am having issues with Maven running the unit tests on my project. The main
error is

java.lang.LinkageError: loader constraints violated when linking
javax/xml/namespace/QName class
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(
RuntimeBuiltinLeafInfoImpl.java:779)

Looking at this list I can see a number of people have hit this and the
solution is to fork the JVM for the unit tests. Looking at the surefire
plugin documentation I have added the following to my POM
  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkMode>each</forkMode>
        </configuration>
      </plugin>

However this make no difference. I then suspected it may be not in the
released version of the plugin - so I tried using the snapshot by adding
<pluginRepository>
      <id>Snapshots</id>
      <name>Snapshots</name>
      <url>http://snapshots.maven.codehaus.org/maven2/</url>
   </pluginRepository>

and forcing the plugin version. This also appears to make no different.

Looking at the code for the plugin in Subversion for surefire it does appear
it supports forking and this is the way to turn in on. Am I doing something
wrong to make it use the plugin?

Has anyone got any ideas of how to get round this issue?

Thanks

Ben

Reply via email to