我们有一个包含大量模块的 Maven 2 项目.示例:
We have a Maven 2 project with lots of modules in it. Example:
<modules> <module>common</module> <module>foo</module> <module>data</module> <module>bar</module> ... more ... </module>假设数据"模块构建起来很耗时,我们希望在项目由 CI 服务器构建时排除它.目前我们使用两个 pom.xml 文件来实现这一点.一个包含所有模块,另一个包含所有模块,除了那些可以省略 CI 的模块.但这很烦人,因为有时我们忘记将新模块放入两个文件中.
Let's say the "data" module is time consuming to build and we want to exclude it when the project is build by a CI server. Currently we use two pom.xml files to achieve this. One has all modules in it and the other one has all modules except the ones which can be left out for CI. But that's pretty annoying because sometimes we forget to put a new module into both files.
是否有不需要两个单独模块列表的解决方案?
Is there a solution which doesn't need two separate module lists?
推荐答案最简单的方法可能是像这样使用 profiles:
The easiest might be to use profiles like this:
<project> ... <modules> <module>common</module> <module>foo</module> <module>bar</module> <modules> ... <profiles> <profile> <id>expensive-modules-to-build</id> <modules> <module>data</module> </modules> </profile> </profiles> </project>然后您应该查看激活配置文件的方法
更多推荐
如何从 Maven reactor 构建中排除模块?
发布评论