[英]XJC episode with maven
如何使用Maven生成劇集? 我現在收到一條錯誤消息: an operand is missing (org.apache.cxf:cxf-xjc-plugin:2.4.0:xsdtojava:generate-sources:generate-sources)
這是我的插件:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<extensions>
<extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.4.0</extension>
</extensions>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<extension>true</extension>
<xsd>my.xsd</xsd>
<packagename>mypackage</packagename>
<extensionArgs>
<arg>-episode</arg>
</extensionArgs>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
<execution>
<configuration>
<xsdOptions>
<xsdOption>
<extension>true</extension>
<xsd>my.xsd</xsd>
<extensionArgs>
<arg>-Xdv</arg>
</extensionArgs>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
編輯:情節的創作運作良好。 在另一個項目中,通過episodes
屬性給出了包含劇集的jar文件。 但是我得到一個例外: Error while parsing schema(s).Location [ file:/D:/workspace/XXX/src/test/resources/XXX.xsd{45,32}]. om.sun.istack.SAXParseException2: compiler was unable to honor this conversion customization. It is attached to a wrong place, or its inconsistent with other bindings. nested in com.sun.istack.SAXParseException2: (the above customization is attached to the following location in the schema)
Error while parsing schema(s).Location [ file:/D:/workspace/XXX/src/test/resources/XXX.xsd{45,32}]. om.sun.istack.SAXParseException2: compiler was unable to honor this conversion customization. It is attached to a wrong place, or its inconsistent with other bindings. nested in com.sun.istack.SAXParseException2: (the above customization is attached to the following location in the schema)
帶有劇集信息的xsd將包含在最終產品中。 該行上的一些xjc:javaType適配器參考。 會引起問題嗎?
與您正在使用的插件不同,但幾年前我一直在使用以下插件。 您可能想查看是否有可用的最新版本的插件等。還要調整使用模式,並在不需要時刪除綁定自定義。
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${basedir}/src/main/xsd</schemaDirectory>
<schemaIncludes>
<schemaInclude>Core.xsd</schemaInclude>
</schemaIncludes>
<bindingDirectory>${basedir}/src/main/xjb</bindingDirectory>
<bindingIncludes>
<bindingInclude>JaxbBindings.xjb</bindingInclude>
</bindingIncludes>
<generateDirectory>${project.build.directory}/generated-sources/jaxb</generateDirectory>
<episode>true</episode>
<episodeFile>${project.build.directory}/generated-sources/jaxb/META-INF/sun-jaxb.episode</episodeFile>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.1.10</version>
</dependency>
</dependencies>
</plugin>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.