lex*_*ope 7 java jaxb schemagen java-7
当我尝试使用maven-jaxb-schemagen-pluginjava 7时
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<version>1.2</version>
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
[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
Run Code Online (Sandbox Code Playgroud)
好像AnnotationProcessorFactory在Java 7中被删除/弃用了?有可能让jaxb schemagen使用这个插件工作吗?在使用JDK 7时,是否有另一种方法可以从JAXB源代码生成模式?
你尝试过使用它org.codehaus.mojo:jaxb2-maven-plugin吗?
这是它的工作原理(将此配置文件添加到您的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>
Run Code Online (Sandbox Code Playgroud)