如何为多模块项目的一个模块执行不同的目标? [英] How to execute a different goal for one module of a multi module project?
问题描述
我有一个由两个不同模块组成的项目.我无法控制这些模块的pom文件,因此无法更改它们.我对项目pom文件有完全控制权.在模块中未将项目ID定义为父项.
文件夹结构:
project
+ module1
+ module2
作为变通方法的一部分,我需要为两个模块执行两个不同的目标,以便将module1安装到本地存储库中,而不是安装到module2中.这只是一个例子.我的实际问题是包含更多的级别,每个级别有2个以上的模块.
为了最小化CI系统所需的配置,我想在一个Maven调用中运行它.
我是在梦见
mvn install -Dspecial=module:compile
这可能吗,如果可以,我该怎么做?
(...)为了最大程度地减少CI系统所需的配置,我想在一个maven调用中运行它.
恐怕这不可能.正如我在 Is this possible and if yes, how do I do that? (...) To minimize the configuration necessary for my CI system, I want to run this in one maven call. I'm afraid this won't be possible. As I explained in this answer, the phase or goal invoked as part of a multi modules build is run against all modules. If you want to run a different phase or goal for a subset of the sub-modules, you'll have to call maven twice, maybe using the 这篇关于如何为多模块项目的一个模块执行不同的目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!mvn install -Dspecial=module:compile
--projects
, -pl
options to pick the right subset:
mvn -pl module1,module3 somegoal
mvn -pl module2 someothergoal