我在几个项目上工作,我经常要对它们进行maven-install。 有没有办法在许多项目中一个接一个地执行许多maven构建? 我希望我能理解。
感谢您的帮助
答案 0 :(得分:0)
我太在意了。 但是对于创建一个新的主要maven项目并没有感到满意 添加所有其他项目以构建其模块项目。
这样我就可以通过触发主项目构建来触发所有项目构建。 但是,这仍然是不可消化的。
答案 1 :(得分:0)
好吧,你可以编写脚本并使用maven的-f开关来指定一个接一个地构建一个pom ......
如果你想坚持使用maven,你可以使用maven exec插件创建一个专用的pom来调用你的构建序列。但这导致了一个naaasty pom。使用它作为最后的手段,因为插件应该只在maven生命周期的一个阶段使用一次。在某些情况下它可能很方便,例如你希望能够在不同的平台上运行你的构建,并且不想用python等编写脚本。):
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>-DskipTests=true</argument>
<argument>-f</argument>
<argument>${basedir}/relative/path/to/other/module/pom.xml</argument>
<argument>clean</argument>
<argument>install</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>-DskipTests=true</argument>
<argument>-f</argument>
<argument>${basedir}/relative/path/to/some/other/module/pom.xml</argument>
<argument>clean</argument>
<argument>install</argument>
</arguments>
</configuration>
</plugin>
</plugins>
<build>
<pluginManagement>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
<pluginManagement>