与maven的XJC情节 [英] XJC episode with maven

查看:142
本文介绍了与maven的XJC情节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用maven生成一集?我现在收到一条错误消息:缺少一个操作数(org.apache.cxf:cxf-xjc-plugin:2.4.0:xsdtojava:generate-sources:generate-sources)

How can I generate an episode with maven? I now get an error message: 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>

编辑:剧集的创作工作正常。在另一个项目中,包含剧集的jar文件通过剧集属性给出。但我得到一个例外:解析模式时出错。位置[文件:/ D:/workspace/XXX/src/test/resources/XXX.xsd {45,32}]。 om.sun.istack.SAXParseException2:编译器无法遵循此转换自定义。它附加到错误的位置,或与其他绑定不一致。嵌套在com.sun.istack.SAXParseException2中:(上面的自定义附加到架构中的以下位置)

Creation of the episode works fine. In another project the jar file containing the episode is given in though the episodes attribute. But I get an Exception: 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适配器引用。这会导致问题吗?

Which is the xsd with episode info that will be included in the final product. Its some xjc:javaType adapter reference on that line. Can that cause problems?

推荐答案

你使用的不同插件,但是几年之后我用过的剪辑工作了。您可能想看看是否有更新版本的插件等。如果不需要,也可以调整使用您的架构并删除绑定自定义。

Different plugin from what you're using, but below snipped used to work for me few years back. You might want to see if more recent version of plugin is available etc. Also tweak to use your schema and remove bindings customization if not needed.

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

这篇关于与maven的XJC情节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆