当我用JDK 8编译我的XSD时,我得到了我期望的输出。
当我用JDK 7编译我的XSD时,似乎没有读取我的binding.xjb文件。
我很确定这是jaxb-v2之间修复的众多缺陷之一
JDK7首次发布JAXB RI 2.2.4-1
JDK8首次发布JAXB RI 2.2.8
发行说明:JAXB
有人可以帮我解决如何更新JDK使用的JAXB RI的版本吗?
我正在使用Maven构建并使用...
的依赖项 <dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-runtime</artifactId>
<version>0.6.4</version>
</dependency>
我使用的插件是......
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<catalog>target/classes/catalog.cat</catalog>
<strict>false</strict>
<extension>true</extension>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
<generatePackage>com.pcmsgroup.v21.esi.deviceservice.bean</generatePackage>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xinheritance</arg>
<arg>-Xcopyable</arg>
<arg>-XenumValue</arg>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.9.5</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.5</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
<configuration>
<catalog>target/classes/catalog.cat</catalog>
<strict>false</strict>
<extension>true</extension>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
<generatePackage>com.jeff.bean</generatePackage>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xinheritance</arg>
<arg>-Xcopyable</arg>
<arg>-XenumValue</arg>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.9.5</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.5</version>
</plugin>
</plugins>
</configuration>
</plugin>
我可能接近这个错误,也许我需要看看org.jvnet.jaxb2.maven2:maven-jaxb2-plugin
答案 0 :(得分:0)
很少有建议:
/plugin/executions/execution/configuration/args
下,一个在/plugin/configuration/args
下。您可以在/plugin/configuration/args
。只需提及示例插件定义以供参考,您可以修剪不需要的详细信息。
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<generatePackage>com.some.sample.package</generatePackage>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<bindingDirectory>src/main/resources/xjb</bindingDirectory>
<generateDirectory>${project.build.directory}/generated-sources</generateDirectory>
<extension>true</extension>
<args>
<arg>-no-header</arg>
<arg>-Xxew</arg>
<arg>-Xxew:instantiate lazy</arg>
<arg>-Xxew:delete</arg>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xvalue-constructor</arg>
<arg>-Xfluent-api</arg>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2.basics.version}</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-fluent-api</artifactId>
<version>${jaxb2.fluentapi.version}</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-value-constructor</artifactId>
<version>${jaxb2.value.constructor.version}</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>${jaxb2.basics.annotate.version}</version>
</plugin>
</plugins>
</configuration>
<executions>
<execution>
<id>abc.xsd</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>abc.xsd</include>
</schemaIncludes>
<bindingIncludes>
<include>abc.binding.xml</include>
</bindingIncludes>
<generatePackage>com.some.sample.package.transfer</generatePackage>
<removeOldOutput>false</removeOldOutput>
<forceRegenerate>true</forceRegenerate>
<cleanPackageDirectories>false</cleanPackageDirectories>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.jaxb-xew-plugin</groupId>
<artifactId>jaxb-xew-plugin</artifactId>
<version>${jaxb.xew.plugin.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb.xjc.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-osgi</artifactId>
<version>${jaxb.xjc.version}</version>
</dependency>
</dependencies>
</plugin>
<jaxb2.basics.version>0.9.2</jaxb2.basics.version>
<jaxb.xew.plugin.version>1.1</jaxb.xew.plugin.version>
<jaxb.xjc.version>2.2.6</jaxb.xjc.version>
<jaxb2.fluentapi.version>3.0</jaxb2.fluentapi.version>
<jaxb2.value.constructor.version>3.0</jaxb2.value.constructor.version>
<javax.xml.bind.version>2.2.6</javax.xml.bind.version>
<jaxb2.basics.annotate.version>1.0.4</jaxb2.basics.annotate.version>