Is it possible to get maven-jaxb-schemagen-plugin working with Java 7?

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 message:

 [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 that AnnotationProcessorFactory is being deleted / deprecated in Java 7? Can jaxb schemagen be used to work with this plugin? Is there an alternative approach for getting schema generation from JAXB source code using JDK 7?

+7
source share
3 answers
+9
source

Here's 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> 
+7
source

Not sure if anyone else is listening to this topic, but hey ...

I used the transformSchemas parameter, for example.

 <transformSchemas> <transformSchema> <uri>YOUR NS IN YOUR GENERATED SCHEMA FILE</uri> <toFile>DESIRED NAME OF YOUR XSD FILE</toFile> </transformSchema> </transformSchemas> 

amuses

-t.

0
source

All Articles