Jenkins的增量构建 [英] Incremental build in Jenkins
问题描述
我正在使用Jenkins 1.462,而Maven版本是3.0.4. 在Jenkins,我启用了增量构建-仅构建已更改的模块"复选框
I am using Jenkins 1.462 and maven version is 3.0.4. At Jenkins I enabled check-box "Incremental build - only build changed modules"
我想找出2个问题:
-
增量构建是否足够? 在这里 http://www.slideshare.net/andrewbayer第19页的/7-habits of high-effective-jenkins-users 表示增量版本是完整版本的补充,而不是替代版本.
Whether incremental build is sufficient? Here How do I trigger a Jenkins build of a single module in a multi-module Maven build from Subversion? for example is stated that it doesn't work at 100% Here http://www.slideshare.net/andrewbayer/7-habits-of-highly-effective-jenkins-users at page 19 is stated that incremental builds are complementary to full builds, not replacements.
增量构建-仅构建已更改的模块是否确实按预期工作? 我的意思是什么?如果我有模块A,B,X,C,D.X使用A和B,C使用X,D使用C,然后在X模块中进行更改.比我想重新编译模块X(itslef),C(直接使用X)和D(在传递闭包中; D使用C,使用C).
Whether Incremental build - only build changed modules is actually works as expected? What I mean by this? If I have modules A, B, X, C, D. X uses A and B, C use X, D use C and I make change in X module. Than I want to recompile modules X (itslef), C (that use X directly) and D (that is in transitive closure; D use C, that use C).
注意:这是我为启用增量构建所做的唯一更改.
Note: this is the only change that I did in order to enable incremental build.
推荐答案
如Maven文档所述,增量版本至少在3.0.4之前不是很可靠:
As stated by Maven documentation incremental builds are not very reliable at least until 3.0.4:
当前(3.0.4)Apache Maven非常不支持增量构建 好吧.
Currently (3.0.4) Apache Maven doesn't support incremental builds very well.
https://cwiki.apache.org/confluence/display/MAVEN/增量+构建(第一行)
相反,我强烈建议您使用以下两种方法中的任何一种来加快构建速度:
Instead, I would strongly suggest using any of these two approaches for speeding up your build:
-
使用并行构建.以我在大型项目中的经验来看,这种方法效果很好,并且可以最大程度地减少构建时间,并将风险降到最低(如果有的话).只需执行
mvn -T 1.5C clean install
https://cwiki之类的命令即可. apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3
如果您的模块是独立的,则可以将它们移到不同的项目中,并使用maven依赖项将它们粘合在一起.
If your modules are independent you can rather move them to different projects and glue them together by using maven dependencies.
这篇关于Jenkins的增量构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!