如何为多模块 Maven 项目配置 Jenkins
我有一个 Maven 多模块项目。结构如下:
-modulA (Main project)
- pom.xml
-parentModul (Aggregator)
- pom.xml
- ModulB (Integration Test Project)
-pom.xml
包定义如下:
<project ...>
<modules>
<module>../modulA</module>
<module>ModulB</module>
</modules>
其中一个模块(ModulA)具有相同的层次结构级别,另一个位于父模块中。
我尝试在 Jenkins 中添加一个作业来自动构建所有内容。 (干净的包)..
我应该如何配置parentModul找到其他模块并构建项目的作业。?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
添加另一个聚合器。将 modulA 和parentModul 放在同一目录中并且比它们高一级,只需添加另一个pom,如下所示:
在 aggregator/pom.xml 中定义一个模块部分,如下所示:
Add another aggregator. Place modulA and parentModul in the same directory and one level above them, simply add another pom like this:
In the aggregator/pom.xml define a modules section as follows:
一种解决方案是使用 SVNExternals 从疯狂的 SVN 结构中组装健全的 Maven 项目工作区,甚至跨不同的 svn 服务器。使用 svn external 并不是一个理想的解决方案,因为它会导致 maven 发布插件和 CI 的 SCM 轮询在某些配置中出现问题。他们告诉你:“你不应该使用 svn externals”,因为这会让生活变得更加困难。但是腿石膏和拐杖也是如此,但是当你断了腿(或 fubar 的 svn 结构)时,你真的不介意带来的不便。
有多种方法可以实现此目的,具体取决于您的 SVN 结构和所需的工作空间结构:
svn co modulA
cd modulA
svn propedit svn:externals .
< strong>注意:请注意行末尾的 (curdir) 点!parentModul http://path.to.your.svn.location.of.parentModul
并且 svn 检索(并提交)您的代码到以下工作区结构
或者您可以向 SVN“工作区”添加一个新目录并添加新目录pom.xml 在那里,并通过 svn 外部获取您可能想要的所有模块到一个级别(或多个级别)。
One solution would be to use SVN Externals to assemble sane Maven project workspace from insane SVN structure even accross different svn servers. Using svn external is not an ideal solution as it will cause problems with maven release plugin and with CI's SCM polling in certain configuration. They tell you : "You should not use svn externals" as makes life more difficult. But so do leg cast and crutches but when you have broken leg (or svn structure that is fubar) you really do not mind the inconvenience.
There several ways of doing this, depending on your SVN structure and desired workspace structure:
svn co modulA
cd modulA
svn propedit svn:externals .
NB: Note the (curdir) dot at the end of line!parentModul http://path.to.your.svn.location.of.parentModul
and the svn retrieves (and commits) you code to following workspace structure
Or you could add a new directory to SVN 'workplace' and add new pom.xml there and get all modules you could ever want via svn externals to one level (or to multiple levels).
这表明您可能错误地将
moduleA
放入
部分。如果moduleA
具有不同的生命周期,那么您应该将其作为依赖项包含在内。This indicates that you're probably wrong in putting
moduleA
in the<modules>
section. IfmoduleA
has different life cycle, then you should include it as a dependency.