maven命令在插件中执行多个执行

时间:2017-08-24 01:18:01

标签: maven jaxws-maven-plugin

我正在尝试从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一样运行。

但有更简单的方法吗?

0 个答案:

没有答案