Max
Max

Reputation: 101

Different source roots for cxf generated classes

I have the following problem. There are a few wsdl files which should be converted into java classses.

<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                    <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>${basedir}/src/main/resources/wsdl/configurationAndSecurityService.wsdl</wsdl>
                        </wsdlOption>
                        <wsdlOption>
                            <wsdl>${basedir}/src/main/resources/wsdl/ordersService.wsdl</wsdl>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

The problem is when wsdls are being converted into java classes I get an error message about duplicates (some classes have the same names). Initially, I wanted to put each wsdl into its owns source root (subpackage), but I don't know how to do that. Is there any way to bind each wsdl to its own source root?

Upvotes: 0

Views: 872

Answers (1)

Dennis Kieselhorst
Dennis Kieselhorst

Reputation: 1397

You would need to split it in multiple executions with different sourceRoots but this may also result in classpath conflicts.

I usually assign different packagenames for each wsdlOption:

  <packagenames>
    <packagename>
      https://www.namespace.de=de.namespace1
    </packagename>
  </packagenames>

See also: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

Upvotes: 1

Related Questions