简体   繁体   English

axistools-maven-plugin wsdl2java如何为每个wsdl设置不同的包

[英]axistools-maven-plugin wsdl2java how to set different packages for each wsdl

I want use the axistools-maven-plugin to generate java classes from wsdl. 我想使用axistools-maven-plugin从wsdl生成Java类。

Now I have this code and it works: 现在我有了这段代码,它可以工作:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>ax-ws-autogen</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
            <configuration>
                <sourceDirectory>src/main/resources/wsdl</sourceDirectory>
                <wsdlFiles>
                    <wsdlFile>myfirstwsdl.wsdl</wsdlFile>
                </wsdlFiles>
                <packageSpaces>my.package.code.first</packageSpaces>
                <testCases>false</testCases>
                <serverSide>false</serverSide>
                <subPackageByFileName>false</subPackageByFileName>
                <outputDirectory>src/main/java</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

Now I need to use another wsdl. 现在,我需要使用另一个wsdl。 So I want add it to this plugin, but in another packages. 所以我想把它添加到这个插件中,但是放在另一个包中。 How can I to do? 我该怎么办?

I see that I can add wsdl file in <wsdlFiles> tag, but I don't know how to add the new package for the new wsdl. 我看到可以在<wsdlFiles>标记中添加wsdl文件,但是我不知道如何为新的wsdl添加新的程序包。

With CXF I can set different wsdl and packages in the <wsdlOptions> tag, but with axis I don't know how to do. 使用CXF,我可以在<wsdlOptions>标记中设置不同的wsdl和程序包,但是对于轴,我不知道该怎么做。

Can you help me, please? 你能帮我吗?

I solved my problem setting <subPackageByFileName> = true and changing <packageSpace> in a general package: 我解决了设置<subPackageByFileName> = true并在常规程序包中更改<packageSpace>的问题:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>ax-ws-autogen</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
            <configuration>
                <sourceDirectory>src/main/resources/wsdl</sourceDirectory>
                <wsdlFiles>
                    <wsdlFile>myfirstwsdl.wsdl</wsdlFile>
                    <wsdlFile>mysecondwsdl.wsdl</wsdlFile>
                </wsdlFiles>
                <packageSpace>my.package.code</packageSpace>
                <testCases>false</testCases>
                <serverSide>false</serverSide>
                <subPackageByFileName>true</subPackageByFileName>
                <outputDirectory>src/main/java</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

In this way I get a single package my.package.code that contain two packages: 这样,我得到一个包含两个包的单个包my.package.code

  • my.package.code.myfirstwsdl with all classes of my first wsdl; my.package.code.myfirstwsdl和我的第一个wsdl的所有类;
  • my.package.code.mysecondwsdl with all classes of my second wsdl. my.package.code.mysecondwsdl和第二个wsdl的所有类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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