cxf-xjc plugin "Must specify xsdOptions" error

3k views Asked by At

I am using cxf-xjc plugin to generate Java classes. This is the xjc command that successfully generates Java classes.

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

I am trying map this xjc command to cxf-xjc plugin.

But i got the following error.

[ERROR] Failed to execute goal org.apache.cxf:cxf-xjc-plugin:2.3.0:xsdtojava (default-cli) on project vcloud-training: Must specify xsdOptions -> [Help 1]

This is the part of the pom about the plugin.

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

What is wrong with the configuration so i am getting this error?

1

There are 1 answers

1
Ice Crown On

try put configuration out of executions like this:

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