When I try to use maven-jaxb-schemagen-plugin
with java 7
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<version>1.2</version>
I get an error:
[ERROR] Failed to execute goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate (default) on project TopologyProvisionerDom: Execution default of goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate failed: A required class was missing while executing com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate: com/sun/mirror/apt/AnnotationProcessorFactory
It seems like the AnnotationProcessorFactory
is being removed/deprecated in Java 7? Is it possible to get jaxb schemagen to work using this plugin? Is there an alternative approach to get schema generation from the JAXB source code when using JDK 7?
Have you tried using the org.codehaus.mojo:jaxb2-maven-plugin
instead?
This is how it works (add this profile to your pom.xml
):
<profile>
<id>jdk7-fix</id>
<activation>
<file><exists>${java.home}/../lib/tools.jar</exists></file>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With