I am generating sources from WSDL. It generate wrapper types. I want JAXB to generate primitive types instead of wrappers.
In pom.xml
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>generate-stubs</id>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sourceType>wsdl</sourceType>
<sources>
<source>
${project.basedir}/src/main/resources/wsdl/my.wsdl
</source>
</sources>
<clearOutputDir>true</clearOutputDir>
</configuration>
</execution>
</plugin>
In my WSDL file
<xs:element minOccurs="0" name="initBal" type="xs:long"/>
In generated class
protected Long initBal;
I tried to set a bindingDirectory to force to use primitive instead of wrappers. But seems that option is not available with jaxb2-maven-plugin 2.5.0 version.
<configuration>
<sourceType>wsdl</sourceType>
<sources>
<source>
${project.basedir}/src/main/resources/wsdl/my.wsdl
</source>
</sources>
<clearOutputDir>true</clearOutputDir>
<xjbSources>
<xjbSource>${project.basedir}/src/main/resources/wsdl/aBindingConfiguration.xjb</xjbSource>
</xjbSources>
</configuration>
aBindingConfiguration.xjb file
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.1">
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>
</jaxb:bindings>