简体   繁体   中英

Generating WSDL2Java from Maven with CXF

For eg I have cxf-codegen-plugin like this:

        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-rt-bindings-soap</artifactId>
                    <version>${cxf.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>generate-jaxb</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <additionalJvmArgs>-Dfile.encoding=UTF8</additionalJvmArgs>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>src/main/resources/wsdl/MyWsdl.wsdl</wsdl>
                                <extraargs>
                                    <extraarg>-wsdlLocation</extraarg>
                                    <extraarg></extraarg>
                                    <extraarg>-client</extraarg>
                                </extraargs>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

It is working just fine when my WSDl is stored in my local project:

src/main/resources/wsdl/MyWsdl.wsdl

What I am trying to achieve is to download the WSDL from remote Maven repository and pass it somehow to the <wsdl> element.

Something like:

<wsdl>
 <dependency>...</dependency>
</wsdl>

I can't find any information about how to do this. Does the option like this even exists? Or it should be done somehow differently then trying to pass the WSDL in the <wsdl> element?

Please advice.

You can use the <wsdlArtifact> to load the WSDL from maven:

<configuration>
    ...
    <wsdlOptions>
        <wsdlOption>
            <wsdlArtifact>
                <groupId>your.group.id</groupId>
                <artifactId>YourWSDLService</artifactId>
                <version>0.1.2-SNAPSHOT</version>
            </wsdlArtifact>
        </wsdlOption>
    </wsdlOptions>
    ...
</configuration>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM