I create code from a wsdl based on the cxf-codegen-plugin. I use additional bindings to
- change the package
- use
Dateinstead ofXmlGregorianCalender
this works fine with version 3.5.5
When I switch to 4.0.0 this does not work anymore (default package and XmlGregorianCalender is used). I could not find anything related in a migration guide.
Here is my configuration
pom.xml
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>https:url?wsdl</wsdl>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
</bindingFiles>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-p</extraarg>
<extraarg>http://url/service=com.some.package</extraarg>
<extraarg>-xjc-Xts:style:org.apache.commons.lang3.builder.ToStringStyle.DEFAULT_STYLE</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
</plugin>
Bindings
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxws="http://cxf.apache.org/jaxws"
version="2.1">
<jaxb:bindings schemaLocation="https://url.file.xsd"
node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:package name="com.some.package.dto" />
</jaxb:schemaBindings>
<jaxb:globalBindings>
<jaxb:javaType name="java.util.Date"
xmlType="xsd:dateTime"
parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDateTime"
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDateTime" />
<jaxb:javaType name="java.util.Date"
xmlType="xsd:date"
parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseDate"
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printDate"/>
<jaxb:javaType name="java.util.Date"
xmlType="xsd:time"
parseMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.parseTime"
printMethod="org.apache.cxf.xjc.runtime.DataTypeAdapter.printTime"/>
</jaxb:globalBindings>
</jaxb:bindings>
</jaxb:bindings>
Unfortunately, it looks like 4.0.0 plugin is buggy. I've got the same problem - binding file is ignored.
I've tested it with single settings: <jaxb:globalBindings typesafeEnumMaxMembers="2000"/>
and always get the same result: [WARNING] WARNING: file:/C:/skr/src/main/resources/Service/language.xsd [3,3]: Simple type "LanguageCodeEnum" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 501, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
So this source is ignored and artifact is not generated.
The same binding file works in the previous (3.5.5) version of plugin.