I'm on my first Java-Spring project. I need to communicate with a couple of webservices. I have some WSDL's provided, so i'm using Jax2B to autogenerate classes.
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.9.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>hello.wsdl</generatePackage>
<forceRegenerate>true</forceRegenerate>
<schemas>
<schema>
<url>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
My project is a web project. The problem here is, my classes are generated in the targets folder, and not in my project. Does somebody have ideas how to fix this? Classes are generated properly, but not at the proper directory. As you can see, i'm using a test wsdl and mockup names at the moment. I followed this tutorial: http://spring.io/guides/gs/consuming-web-service/
Many thanks in advance
Author of the maven-jaxb2-pugin
here.
target/generated-sources/xjc
IS the proper directory. This is how generated code is handled in Maven builds, you never generate anything into src/main/java
.
The maven-jaxb2-plugin
also adds this directory to the Maven's sources directories. You just have to make sure that this directory is considered a source directory by your IDE. In Eclipse, m2eclipse plugin does this automatically when you do "Update project".
See this part of the docs.
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