How to specify frontend for wsdl2java in a pom.xml?

大兔子大兔子 提交于 2019-12-19 06:52:05

问题


I found this great tip about adding -fe jaxws21 to the wsdl2java command to have it generate jaxws 2.1 compliant code instead of 2.2, but Maven's pom.xml doesn't seem to like this addition when placed like this:

            <goals>
                <goal>wsdl2java -fe jaxws21</goal>
            </goals>

What is the correct way of specifying a frontend for wsdl2java that's used in a pom.xml?


回答1:


If you are using cxf-codegen-plugin, you can add the arguments in extraargs element:

<executions>
    <execution>
        <configuration>
            <wsdlOptions>
                <wsdlOption>
                    <wsdl>...</wsdl>
                    <extraargs>
                        <extraarg>-fe</extraarg>
                        <extraarg>jaxws21</extraarg>
                    </extraargs>
                </wsdlOption>
            </wsdlOptions>
        </configuration>
        <goals>
            <goal>wsdl2java</goal>
        </goals>
    </execution>
</executions>

Source: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html




回答2:


You can use <frontEnd> inside <wsdlOption> or <defaultOption>. The latter is helpful, if you include multiple WSDLs and specified <wsdlRoot>:

<executions>
    <execution>
        <configuration>
            <defaultOptions>
                <frontEnd>jaxws21</frontEnd>
            </defaultOptions>
            <wsdlRoot>${basedir}/src/main/wsdl</wsdlRoot>
            <includes>
                <include>*.wsdl</include>
            </includes>
        </configuration>
        <goals>
            <goal>wsdl2java</goal>
        </goals>
    </execution>
</executions>



回答3:


To complement @fishbone's and @tafit3's answers, see also Could not find jaxws21 frontend within classpath because it looks like frontend was added in a minor cxf version.

I tried their answers but only got things working after upgrading cxf-codegen-plugin to 2.3.11



来源:https://stackoverflow.com/questions/14104523/how-to-specify-frontend-for-wsdl2java-in-a-pom-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!