Custom package names cxf-codegen-plugin

前端 未结 1 1004
离开以前
离开以前 2021-02-01 21:33

Imagine this scenario.

I have a wsdl file with namespace a/b/c and it imports another wsdl whose namespace is m/n/o. Unfortunately, both of them have same ComplexTypes X

相关标签:
1条回答
  • 2021-02-01 21:53

    If you want to generate package depending on the namespace here is the solution:

    <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>2.6.0</version>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                    <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>yourWsdl.wsld</wsdl>
                            <extraargs>
                                <extraarg>-client</extraarg>
                                <extraarg>-verbose</extraarg>
                                <extraarg>-p</extraarg>
                                <extraarg>http://your.namespace/services/=your.package</extraarg>
                                <extraarg>-p</extraarg>
                                <extraarg>http://your.namespace2/services2/=your.package2</extraarg>
                            </extraargs>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    This <extraarg>http://your.namespace2/services2/=your.package2</extraarg> will map your namespace with the package you want.

    0 讨论(0)
提交回复
热议问题