I have set up a simple cxf maven auto generation from a WSDL
file. But I get the following exception. What am I missing?
Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:3.0.0:wsdl2java failed: org.apache.cxf.tools.common.toolspec.parser.BadUsageException: Duplicated option: frontend (org.apache.cxf:cxf-codegen-plugin:3.0.0:wsdl2java:generate-sources:generate-sources)
pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<defaultOptions>
<extraargs>
<extraarg>-fe</extraarg>
<extraarg>cxf</extraarg>
</extraargs>
</defaultOptions>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.basedir}/src/main/resources/MyService.wsdl</wsdl>
<wsdlLocation>classpath:/MyService.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.0.0</version>
</dependency>
<dependencies>
Maven debug shows the following:
[DEBUG] Calling wsdl2java with args: [-encoding, UTF-8, -d, \target\generated\src\main\java, -fe, cxf, -fe, cxf, -wsdlLocation, classpath:wsdl/MyService.wsdl,...
Why is the frontent -fe
created twice??
Remove that <extraargs><extraarg>-fe</extraarg><extraarg>cxf</extraarg></extraargs>
section.
Add this extraarg in wsdlOption
<wsdlOption>
<extraarg>-autoNameResolution</extraarg>
</wsdlOption>
Ran into the exact same problem. You have to disable the directory scan. Then you can keep the extraargs in the default options and don't have to repeat them for all the wsdlOptions.
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<disableDirectoryScan>true</disableDirectoryScan>
<defaultOptions>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-validate</extraarg>
<extraarg>-client</extraarg>
<extraarg>-suppress-generated-date</extraarg>
</extraargs>
</defaultOptions>
<!--wsdlOptions-->
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With