Reputation: 23
I am autogenerating my wsdl using spring-ws and an XSD. Now I would like to generate java classes to return and do marschalling.
However I am seeing a lot of different ways to accomplish this, and not all are as clear about the benefit\detrement.
Some just save the generated WSDL in their project, others use their XSD file to generate, others add XJB etc...
My first thought was just adding:
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<removeOldOutput>true</removeOldOutput>
<schemaDirectory>src/main/webapp/WEB-INF</schemaDirectory>
</configuration>
</plugin>
to my pom.xml
Upvotes: 2
Views: 6174
Reputation: 2456
to use maven to generate java code from WSDL, you can check maven cxf codegen plugin wsdl to java.
Upvotes: 0
Reputation: 2842
My preferred way is jaxb2-maven-plugin. See http://mojo.codehaus.org/jaxb2-maven-plugin/usage.html
It's actually using XJC, a command that now comes with your current JDK (under bin in Windows or Commands in Mac)
You can call it directly with xjc -p your.package -wsdl your.wsdl
Upvotes: 4