2

我正在尝试从 wsdl 生成源

这是我的插件。

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${basedir}/target/generated-sources/wsdl</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>1.12</version>
            <executions>
                <execution>
                    <id>gen1</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <packageName>pkg1</packageName>
                        <wsdlDirectory>${basedir}/src/main/resources/wsdl/xml1</wsdlDirectory>
                        <keep>true</keep>
                        <sourceDestDir>${basedir}/target/generated-sources/wsdl</sourceDestDir>
                    </configuration>
                </execution>
                <execution>
                    <id>gen2</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <packageName>pkg2</packageName>
                        <wsdlDirectory>${basedir}/src/main/resources/wsdl/xml2</wsdlDirectory>
                        <keep>true</keep>
                        <sourceDestDir>${basedir}/target/generated-sources/wsdl</sourceDestDir>
                    </configuration>
                </execution>
            </executions>
        </plugin>

当我运行时mvn compile,只有gen1生成。我希望它生成两个执行。我无法将它们组合起来,因为它们位于不同的 wsdl 目录中并且需要不同的包名。

我知道我可以拆分为配置文件并像mvn compile -Pprofile1,profile2.

但是有没有更简单的方法?

4

0 回答 0