Hi, one of our classes use the bundled jaxb api of jdk 1.6. When I try to compile this using maven (JAVA_HOME is set to JDK 1.6 and it shows in the IDE that maven runs using JDK 1.6) I get a class not found error for the jaxb library. the class in question is present in rt.jar under JDK 1.6 lib folder. Any ideas???
Try adding this plugin to your pom.xml Maven build section:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Update: That doesn't work.
Have you tried this?
<dependency>
<groupid>javax.xml.bind</groupid>
<artifactid>jaxb-api</artifactid>
<version>2.1</version>
<scope>system</scope>
<systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>
Well... the error was due to the usage of one of the sun's internal class which was not available during maven compile. Its an interesting scenario though...
My project uses NamespaceMapper provided by sun's internal JAXB libraries. It compiled in a non mavenized eclipse environment(with a warning) since the rt.jar was there in the classpath. We started to mavenize this project and all of a sudden I got a ClassNotFound for this. After some googling I came across these two posts which got me going in the right direction.
http://forums.java.net/jive/thread.jspa?threadID=24225
http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg1PK88316
BottomLine : Do not use internal libraries (the package names have internal in them).