I am using jaxws-maven-plugin
to generate some JAX-WS clients based on WSDL files.
I need to use JDK 1.6 so I am executing with JAX-WS Tools 2.1.7
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.7</version>
</dependency>
If I use recent versions of jaxws-maven-plugin
2.2.1
or 2.3
over the 2.1.7 jaxws-tools my build doesn't work because an invalid -encoding parameter is added to the command line.
unrecognized parameter -encoding
Full command is
[DEBUG] cmd.exe /X /C ""C:\Program Files\Java\jdk1.6.0_45\jre\bin\java.exe" -Xbootclasspath/p:.m2\repository\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar;.m2\repository\javax\xml\soap\saaj-api\1.3\saaj-api-1.3.jar;.m2\repository\javax\xml\ws\jaxws-api\2.1\jaxws-api-2.1.jar org.jvnet.jax_ws_commons.jaxws.Invoker com.sun.tools.ws.wscompile.WsimportTool -keep -s <some dir> -d <some dir> -encoding UTF-8 -p <some package> file:<some wsdl file>"
The following pom.xml is working fine, I use 2.2 which does not send the encoding parameter.
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version> <!-- This version works fine -->
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<wsdlDirectory>src/wsdl</wsdlDirectory>
<sourceDestDir>src/main/java</sourceDestDir>
<wsdlFiles>
<wsdlFile>ConsultarStatusNfe.wsdl</wsdlFile>
</wsdlFiles>
<!-- for JDK 6 compilation compatibility -->
<xnocompile>false</xnocompile>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
I was able to use the latest versions by setting the <target>2.1</target>
configuration.
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase/>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<wsdlDirectory>src/wsdl</wsdlDirectory>
<sourceDestDir>src/main/generated</sourceDestDir>
<wsdlFiles>
<wsdlFile>myfile.wsdl</wsdlFile>
</wsdlFiles>
<packageName>com.souzacruz.pwnfeintegrator</packageName>
<!-- for JDK 6 compilation compatibility -->
<xnocompile>false</xnocompile>
<target>2.1</target>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.10</version>
</dependency>
</dependencies>
</plugin>