cxf-xjc插件“必须指定xsdOptions”错误

时间:2017-11-28 08:33:18

标签: java xml maven cxf-xjc-plugin

我正在使用cxf-xjc插件来生成Java类。 这是成功生成Java类的xjc命令。

  

xjc -d C:\ Users \ abc \ devEnv \ VcloudJavaClasses -catalog   C:\ Users \ abc \ devEnv \ schema-files \ schemas \ external \ catalog.xml -b   C:\ Users \ abc \ devEnv \ schema-files \ 1.5 \ schemas \ vcloud \ vcloud.xjb -b   C:\ Users \ abc \ devEnv \ schema-files \ 1.5 \ schemas \ vcloud \ ovf.xjb -b   C:\用户\ ABC \ devenv的\架构文件\ 1.5 \模式\推广\ vmwextensions.xjb   C:\用户\ ABC \ devenv的\架构文件\ 1.5 \模式\主\ master.xsd   C:\用户\ ABC \ devenv的\架构文件\ 1.5 \模式\推广\ vmwextensions.xsd   -nv

我正在尝试将此xjc命令映射到cxf-xjc插件。

但是我收到了以下错误。

  

[错误]无法执行目标   org.apache.cxf:cxf-xjc-plugin:2.3.0:项目中的xsdtojava(default-cli)   vcloud-training:必须指定xsdOptions - > [帮助1]

这是关于插件的pom的一部分。

    <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-xjc-plugin</artifactId>
        <version>2.3.0</version>
        <configuration>
            <extensions>
                <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
            </extensions>
        </configuration>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>xsdtojava</goal>
                </goals>
                <configuration>
                    <sourceRoot>C:\Users\abc\devEnv\schema-files-pom</sourceRoot>
                    <xsdOptions>
                        <xsdOption>
                            <xsd>C:\Users\abc\devEnv\schema-files\1.5\schemas\master\master.xsd</xsd>
                            <xsd>C:\Users\abc\devEnv\schema-files\1.5\schemas\extension\vmwextensions.xsd</xsd>
                            <bindingFile>classpath:/schemas/wsdl/http.xjb</bindingFile>
                            <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\vcloud\vcloud.xjb</bindingFile>
                            <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\vcloud\ovf.xjb</bindingFile>
                            <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\extension\vmwextensions.xjb</bindingFile>
                            <catalog>C:\Users\abc\devEnv\schema-files\schemas\external\catalog.xml</catalog>
                        </xsdOption>
                    </xsdOptions>
                </configuration>
            </execution>
        </executions>
    </plugin>

配置有什么问题,所以我收到了这个错误?

1 个答案:

答案 0 :(得分:2)

尝试将配置从这样的执行中删除:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-xjc-plugin</artifactId>
    <version>2.3.0</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>xsdtojava</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <sourceRoot>C:\Users\abc\devEnv\schema-files-pom</sourceRoot>
        <xsdOptions>
            <xsdOption>
                <xsd>C:\Users\abc\devEnv\schema-files\1.5\schemas\master\master.xsd</xsd>
                <xsd>C:\Users\abc\devEnv\schema-files\1.5\schemas\extension\vmwextensions.xsd</xsd>
                <bindingFile>classpath:/schemas/wsdl/http.xjb</bindingFile>
                <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\vcloud\vcloud.xjb</bindingFile>
                <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\vcloud\ovf.xjb</bindingFile>
                <bindingFile>C:\Users\abc\devEnv\schema-files\1.5\schemas\extension\vmwextensions.xjb</bindingFile>
                <catalog>C:\Users\abc\devEnv\schema-files\schemas\external\catalog.xml</catalog>
            </xsdOption>
        </xsdOptions>
        <extensions>
            <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.3.0</extension>
        </extensions>
    </configuration>
</plugin>