3

我们的应用程序有一个特殊要求:针对 wsdl生成的文件应该有一个给定的包名针对 xsd 文件生成的文件应该有另一个包名

似乎没有办法使用 jaxws maven 插件来自定义它。这是我们当前的配置:

    <execution>
        <id>wsimport-finderpro</id>
        <phase>generate-sources</phase>
        <goals>
            <goal>wsimport</goal>
        </goals>
        <configuration>
            <bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
            <bindingFiles>
                <bindingFile>ServerResponse_login.xsd</bindingFile>
                <bindingFile>OpenDirectAccessSession.xsd</bindingFile>
            </bindingFiles>
            <!--wsdls file directory -->
            <wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
            <!-- which wsdl file -->
            <wsdlFiles>
                <wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
            </wsdlFiles>
            <!-- Keep generated files -->
            <keep>true</keep>
            <!-- Package name -->
            <packageName>com.mycompany.world.worldlink.finderpro.ws</packageName>
            <!-- generated source files destination-->
            <sourceDestDir>target/generated-code/src</sourceDestDir>
            <staleFile>target/jaxws/fp/.staleFlag</staleFile>
            <target>2.1</target>
        </configuration>
    </execution>

有人可以请教吗?

编辑1:我想出了以下代码:

            <execution>
                <id>wsimport-finderpro-01</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>wsimport</goal>
                </goals>
                <configuration>
                    <bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
                    <bindingFiles>
                        <bindingFile>OpenDirectAccessSession.xsd</bindingFile>
                    </bindingFiles>
                    <!--wsdls file directory -->
                    <wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
                    <!-- which wsdl file -->
                    <wsdlFiles>
                        <wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
                    </wsdlFiles>
                    <!-- Keep generated files -->
                    <keep>true</keep>
                    <!-- Package name -->
                    <packageName>com.ids.world.worldlink.finderpro.xmlstubs</packageName>
                    <!-- generated source files destination-->
                    <sourceDestDir>target/generated-code/src</sourceDestDir>
                    <staleFile>target/jaxws/fp-01/.staleFlag</staleFile>
                    <target>2.1</target>
                </configuration>
            </execution>
            <execution>
                <id>wsimport-finderpro-02</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>wsimport</goal>
                </goals>
                <configuration>
                    <bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
                    <bindingFiles>
                        <bindingFile>GetAllMyEntityQuotes.xsd</bindingFile>
                    </bindingFiles>
                    <!--wsdls file directory -->
                    <wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
                    <!-- which wsdl file -->
                    <wsdlFiles>
                        <wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
                    </wsdlFiles>
                    <!-- Keep generated files -->
                    <keep>true</keep>
                    <!-- Package name -->
                    <packageName>com.ids.world.worldlink.finderpro.xmlstubs.allMyEntityQuotes</packageName>
                    <!-- generated source files destination-->
                    <sourceDestDir>target/generated-code/src</sourceDestDir>
                    <staleFile>target/jaxws/fp-02/.staleFlag</staleFile>
                    <target>2.1</target>
                </configuration>
            </execution>

问题是我注意到许多类被重新生成了几次(这里是 x2),我最终在不同的包中得到了相同的类。

如何确保为 wsdl 生成的类生成一次,并为 xsd 生成类并放置在它们各自的包中

4

0 回答 0