Swtiching our build from Ant to Maven, I'm trying to generate code from WSDL files.
There is the maven-jaxws-tools-plugin
, but I always get an Exception. I'm not completely clear on what dependencies this plugin additionally has.
The Plugin config:
<plugin>
<groupId>org.jboss.ws.plugins</groupId>
<artifactId>maven-jaxws-tools-plugin</artifactId>
<version>1.1.1.Final</version>
<configuration>
<targetPackage>at.dataphone.logis3.wsdl.${projectName}</targetPackage>
<extensions>true</extensions>
<wsdls>
<wsdl>${basedir}/wsdl/DPHItemBarcodesList.wsdl</wsdl>
</wsdls>
</configuration>
<executions>
<execution>
<goals>
<goal>wsconsume</goal>
</goals>
</execution>
</executions>
</plugin>
With no additional deps I get:
ClassNotFoundException: org.jboss.ws.api.tools.WSContractConsumer
Then I add:
<dependency>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native-client</artifactId>
<version>4.0.2.GA</version>
</dependency>
So I get:
java.lang.ClassNotFoundException: com.sun.tools.ws.wscompile.WsimportTool`
And if I add:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.7</version>
</dependency>
But I get:
java.lang.ClassNotFoundException: org.jboss.util.xml.JBossEntityResolver`
So this goes on and on. But I have the feeling, that I don't want all of these compile time dependencies and that I might need a way to tell the plugin about my JBoss installation with it's modules.
There is only litte documentation for the plugin.
There is this sample: https://developer.jboss.org/wiki/JAXWSToolsMavenPluginSample
But jbossws-cxf-client
can't be a dependency, this is old code and uses jbossws-native.
I'm also not sure if the jboss-as-maven-plugin has anything to do with it, but I don't want to deploy, only generate the code. I actaully do have the plugin set-up, although it doesn't work properly. But running mvn jboss-as:deploy
it still fails at the jaxws-plugin before it can do any deployment.
This example is slightly different, but not much: https://github.com/tkobayas/example-projects/blob/master/helloworld_jaxws_cxf/pom.xml
I'm not familiar with the maven-jaxws-tools-plugin
but you don't need to add compile-time dependencies: you just need to add those dependencies as plugin dependencies:
<plugin>
<groupId>org.jboss.ws.plugins</groupId>
<artifactId>maven-jaxws-tools-plugin</artifactId>
<version>1.1.1.Final</version>
<configuration>
<targetPackage>at.dataphone.logis3.wsdl.${projectName}</targetPackage>
<extensions>true</extensions>
<wsdls>
<wsdl>${basedir}/wsdl/DPHItemBarcodesList.wsdl</wsdl>
</wsdls>
</configuration>
<executions>
<execution>
<goals>
<goal>wsconsume</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native-client</artifactId>
<version>4.0.2.GA</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.7</version>
</dependency>
</dependencies>
</plugin>
This way, those dependencies will only be used during the execution of the plugin and won't be added to your project compile-time dependencies. Of course, this only should be done when your project won't depend on those at compile-time.
You can then add in this tag all the necessary dependencies. For the class org.jboss.util.xml.JBossEntityResolver
, it looks like the next one on the list is jboss-common-core
...
On a side-note, you should maybe consider using the cxf-codegen-plugin
by from the Apache CXF project.