[ 
https://issues.apache.org/jira/browse/CXF-9154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Yue Fang resolved CXF-9154.
-----------------------------------
    Resolution: Information Provided

> [cxf-codegen-plugin][WSDL2Java] Incorrect Adapter Usage with Multiple 
> executions
> --------------------------------------------------------------------------------
>
>                 Key: CXF-9154
>                 URL: https://issues.apache.org/jira/browse/CXF-9154
>             Project: CXF
>          Issue Type: Wish
>    Affects Versions: 4.1.2
>            Reporter: Sullivan Pineau
>            Assignee: Freeman Yue Fang
>            Priority: Major
>
> Hello,
> We are experiencing a problem with the cxf-codegen-plugin when running 
> multiple executions under the goal wsdl2java. Specifically, we have 
> configured two executions where each references a different WSDL and binding 
> file. Although the plugin successfully generates code for both WSDLs, the 
> Adapter being generated and used for both seems to derive from the binding of 
> the last execution.
> For example :
> Binding 1 (/src/main/resources/service1/binding.xml) :
> {code:xml}
> <bindings xmlns="https://jakarta.ee/xml/ns/jaxb"; version="3.0"
>           xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>     <globalBindings>
>         <javaType name="java.util.Calendar" xmlType="xs:dateTime"
>                   
> parseMethod="jakarta.xml.bind.DatatypeConverter.parseDateTime"
>                   
> printMethod="jakarta.xml.bind.DatatypeConverter.printDateTime"/>
>     </globalBindings>
> </bindings>
> {code}
> Binding 2 (/src/main/resources/service2/binding.xml) :
> {code:xml}
> <bindings xmlns="https://jakarta.ee/xml/ns/jaxb"; version="3.0"
>           xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>     <globalBindings>
>         <javaType name="java.util.Calendar" xmlType="xs:dateTime"
>                   parseMethod="com.example.demo.ConverterCustom.parseDateTime"
>                   
> printMethod="com.example.demo.ConverterCustom.printDateTime"/>
>     </globalBindings>
> </bindings>
> {code}
> pom.xml
> {code:xml}
> ...
>             <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <version>${cxf.version}</version>
>                 <executions>
>                     <execution>
>                         <id>generate-sources-service-1</id>
>                         <phase>generate-sources</phase>
>                         <configuration>
>                             <defaultOptions>
>                                 
> <bindingFiles><bindingFile>${project.basedir}/src/main/resources/service1/binding.xml
>                                     </bindingFile>
>                                 </bindingFiles>
>                             </defaultOptions>
>                             <wsdlOptions>
>                                 
> <wsdlOption><wsdl>${project.basedir}/src/main/resources/service1/service1.wsdl</wsdl>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                     </execution>
>                     <execution>
>                         <id>generate-sources-service-2</id>
>                         <phase>generate-sources</phase>
>                         <configuration>
>                             <defaultOptions>
>                                 
> <bindingFiles><bindingFile>${project.basedir}/src/main/resources/service2/binding.xml
>                                     </bindingFile>
>                                 </bindingFiles>
>                             </defaultOptions>
>                             <wsdlOptions>
>                                 
> <wsdlOption><wsdl>${project.basedir}/src/main/resources/service2/service2.wsdl</wsdl>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> ...
> {code}
> We have noticed that the same adapter (Adapter1.class) is used for both 
> generated classes that possess attributes requiring the annotation 
> XmlJavaTypeAdapter. The adapter utilized is 
> org/w3/_2001/xmlschema/Adapter1.java, which corresponds to the last execution.
>  
> Refer to the example project here: [Example 
> Project|https://github.com/PineauSullivan/issue_cfx].
>  
> Please let us know if you need more details or any configuration snippets. We 
> look forward to your guidance on resolving this issue.
> Thank you!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to