3

我正在使用 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:\Users\abc\devEnv\schema-files\1.5\ schemas\extension\vmwextensions.xjb C:\Users\abc\devEnv\schema-files\1.5\schemas\master\master.xsd C:\Users\abc\devEnv\schema-files\1.5\schemas\extension\vmwextensions。 xsd -nv

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

但我收到以下错误。

[错误] 无法在项目 vcloud-training 上执行目标 org.apache.cxf:cxf-xjc-plugin:2.3.0:xsdtojava (default-cli):必须指定 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>

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

4

1 回答 1

8

尝试将配置退出执行,如下所示:

<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>
于 2018-07-31T02:10:52.820 回答