如何从 Maven reactor 构建中排除模块?

编程入门 行业动态 更新时间:2024-10-23 13:31:26
本文介绍了如何从 Maven reactor 构建中排除模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们有一个包含大量模块的 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 构建中排除模块?

本文发布于:2023-11-16 17:01:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606171.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   Maven   reactor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!