Maven plugin for JAXWS tools
By JBossWS Team | March 1, 2010
JBossWS comes with JAXWS tools for top-down and bottom-up webservice development.
- Starting from today, a [
- Maven plugin
- ](http://repository.jboss.org/maven2/org/jboss/ws/plugins/) is available for easily embedding tools' invocation into your own project's
- pom.xml
<build> <plugins> <plugin> <groupId>org.jboss.ws.plugins</groupId> <artifactId>maven-jaxws-tools-plugin</artifactId> <version>1.0.0.GA</version> <configuration> <wsdls> <wsdl>${basedir}/test.wsdl</wsdl> <wsdl>${basedir}/test2.wsdl</wsdl> </wsdls> <targetPackage>foo.bar</targetPackage> <extension>true</extension> </configuration> <executions> <execution> <goals> <goal>wsconsume</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
this makes wsconsume parse the specified wsdl files and generate java sources for the SEI, wrapper, etc. The classes are then compiled together with all the other ones in your project.
Similarly you can use
wsprovide
, see the example below:
<build>
<plugins>
<plugin>
<groupId>org.jboss.ws.plugins</groupId>
<artifactId>maven-jaxws-tools-plugin</artifactId>
<version>1.0.0.GA</version>
<configuration>
<verbose>true</verbose>
<endpointClass>org.jboss.test.ws.plugins.tools.wsprovide.TestEndpoint</endpointClass>
<generateWsdl>true</generateWsdl>
</configuration>
<executions>
<execution>
<goals>
<goal>wsprovide</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
The plugin has sensible defaults, in particular for computing the classpath to be used before invoking the tools; you just need to make sure your project declares dependencies on a jbossws stack (which you most probably already do, if you have ws endpoints there).
So it's really just a matter of declaring the plugin in the pom.xml and running ;-)
All stacks (JBossWS-Native, JBossWS-CXF, JBossWS-Metro) are supported by the plugin.
A couple of additional complete sample pom.xml files are available on the SCM, for instance take a look at this.
Enjoy!