从另一个Maven安装命令触发Maven安装命令 [英] Trigger a maven install command from another maven install command
问题描述
是否有一种方法可以从另一个maven安装命令中触发一个maven安装命令?
Is there a way to trigger a maven install command from another maven install command?
换句话说,我希望能够在Maven项目上(在Eclipse中)执行Maven安装命令,并且我希望这将自动在另一个Maven项目上引起安装命令. 有可能吗?
In other words, I would like to be able to execute a maven install command on a maven project (in eclipse) and I want that this will automatically cause an install command on another maven project. Is that possible?
推荐答案
如前所述,在一组模块上启动目标(让我们说mvn install
)的一种行之有效的方法是将它们组织为一个多模块项目并在父pom上启动目标.在幕后,Maven将使用"Maven反应堆"进行这项工作.反应堆将通过对模块之间的依赖关系构造的有向图的节点进行拓扑排序来计算构建顺序.该图是通过查看poms中的<modules>
和<dependencies>
标记构造的.
As pointed out, the maven way to launch a goal (lets say mvn install
) on a set of modules is to organize them as a multi-module project and to launch the goal on the parent pom. Behind the scene, Maven will use a "Maven reactor" for this work. The reactor will calculate the build order by doing a topological sort of the nodes of the directed graph constructed by the dependency relation between modules. This graph is constructed by looking at <modules>
and <dependencies>
tags in poms.
但是从父级启动maven并不是唯一的选择,并且maven提供了更多与反应堆一起玩的可能性(例如,制作项目及其依赖项或依赖于它的依赖项):
But launching maven from a parent is not the only option and maven offers more possibilities to play with the reactor (e.g. making a project and its dependencies or those that depend on it):
-
对于maven 2.0.x,您必须使用反应堆插件: http://maven.apache.org/plugins/maven-reactor-plugin/(请参见在Maven 2.1+中,您可以使用本机命令行选项:
With maven 2.1+ you can use native command line options : http://www.sonatype.com/people/2009/03/maven-210-released/ (see the new build mode options
-amd
,-rf
,-am
,-pl
)检查一下,可能会帮助您实现目标.
Check it out, it might help you to achieve your goal.
这篇关于从另一个Maven安装命令触发Maven安装命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!