如何从Maven反应堆构建中排除模块?

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

我们有一个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反应堆构建中排除模块?

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

发布评论

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

>www.elefans.com

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