[英]Maven multi-module project and Jenkins
I have the following projects organized in a flat structured way: 我有以下项目以扁平结构的方式组织:
parentProject
+-pom.xml
projectWeb <depends on libraryA and libraryB>
+-pom.xml
libraryA
+-pom.xml
libraryB
+-pom.xml
The pom.xml inside the parentProject has references to the other modules and its used for inheritance and dependencyManagement, here is a snippet: parentProject中的pom.xml引用了其他模块,并用于继承和dependencyManagement,这里是一个片段:
<project>
....
<modules>
<module>../projectWeb</module>
<module>../libraryA</module>
<module>../libraryB</module>
</modules>
<dependencyManagement>
...
</dependencyManagement>
<build>
...
</build>
....
</project>
In Jenkins I have one maven job for each project, and it works fine when I build the parentProject, ie. 在Jenkins中,我为每个项目都有一个maven作业,当我构建parentProject时,它工作正常,即。 builds every project referenced in the modules
section. 构建modules
部分中引用的每个项目。 The problem that I have is when I commit to the SVN a change in libraryA
, I would expect that after building libraryA, a rebuild to projectWeb
to be launched, but that didn't happen. 我遇到的问题是当我向SVN提交更改libraryA
,我希望在构建libraryA之后,重建到projectWeb
才能启动,但这并没有发生。 Anyone knows what am I doing wrong? 谁知道我做错了什么?
Thanks in advance. 提前致谢。
EDIT 编辑
When I remove the modules
section from parentProject\\pom.xml
, it works as espected, but I loose the aggregation advantage of having a parent pom. 当我从parentProject\\pom.xml
删除modules
部分时,它按预期工作,但我放弃了拥有父pom的聚合优势。
It looks like you're asking your parent POM to do two things: 看起来你要求你的父母POM做两件事:
It's generally better if you split this out into two poms - a parent pom for #1 and an aggregate pom for #2. 如果将它分成两个pom,通常会更好 - 一个是#1的父pom,另一个是#2的聚合pom。 You'd then have something like.. 你会有类似的东西......
[root dir] aggregate pom.xml
+ /parent
+ /web
+ /libA
+ /libB
See this answer for more details: https://stackoverflow.com/a/3301162/211993 有关更多详细信息,请参阅此答案: https : //stackoverflow.com/a/3301162/211993
You'd then configure Jenkins to check out the root dir and run "mvn clean install" 然后,您将配置Jenkins以检出根目录并运行“mvn clean install”
This should be configured in jenkins job. 这应该在jenkins工作中配置。 See "libraryA job"/"Configuration"/"Build Triggers"/"Build after other projects are built" 请参阅“libraryA job”/“Configuration”/“Build Triggers”/“构建其他项目后构建”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.