我在几个项目上工作,我经常不得不在上面进行maven-install。有没有办法在许多项目上一个接一个地执行多个maven构建?我希望我能被理解。
感谢你的帮助
发布于 2013-06-20 21:58:32
我太期待了。但仅仅创建一个新的主maven项目并添加所有其他项目作为其模块项目并不能让人满意。
这样,我就可以通过触发主项目构建来触发所有项目构建。但是,这仍然是不可消化的。
发布于 2013-06-21 02:32:44
嗯,你可以编写脚本并使用maven的-f开关来指定一个接一个地构建哪个pom……
如果你想继续使用maven,你可以使用maven exec插件来创建一个专用的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>https://stackoverflow.com/questions/17215225
复制相似问题