Reputation: 73
I have such Apache Cxf maven plugin config:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<defaultOptions>
<bindingFiles>
<bindingfile>${basedir}/src/main/resources/jaxb-binding.general.xml</bindingfile>
</bindingFiles>
</defaultOptions>
<sourceRoot>
src/main/java/my/generated/services
</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${server1}/Service1.svc?wsdl</wsdl>
</wsdlOption>
<wsdlOption>
<wsdl>${server2}/Service2?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
I basically have 2 questions, maybe someone could answer those:
1) How can I extract those 2 Service endpoints to different directories? Now it would be "src/main/java/my/generated/services" for both. I would like to have: src/main/java/my/generated/services/service1 and src/main/java/my/generated/services/service2.
2) How can I setup that generated java files packages would be my.generated.services.service1 + (generated file package name) for Service1 and my.generated.services.service2 + (generated file package name) for Service2?
I tried to configure that using binding file, but only found solution for specific namespaces.. But haven't found anything more generic.
Thanks for help!
Upvotes: 0
Views: 1532
Reputation: 10024
Easiest way I find to generate files to different directory is using two different executions of WSDL2Java plugin as show below.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources-service1</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/my/generated/services</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${server1}/Service1.svc?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
<execution>
<id>generate-sources-services2</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/my/generated/services</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${server2}/Service2?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 2