[英]control schema file name created by jaxb schemagen maven plugin (maven-jaxb-schemagen-plugin)
[英]Is it possible to get maven-jaxb-schemagen-plugin working with Java 7?
当我尝试在java 7中使用maven-jaxb-schemagen-plugin
时
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<version>1.2</version>
我收到一个错误:
[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
似乎在Java 7中删除/弃用了AnnotationProcessorFactory
? 有可能让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>
不确定是否有人正在听这个帖子但是,嘿......
我使用了transformSchemas
选项,例如
<transformSchemas>
<transformSchema>
<uri>YOUR NS IN YOUR GENERATED SCHEMA FILE</uri>
<toFile>DESIRED NAME OF YOUR XSD FILE</toFile>
</transformSchema>
</transformSchemas>
干杯
-m。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.