Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incremental build in 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"

I want to figure out 2 questions:

  1. 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.

  2. 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.

like image 276
alexsmail Avatar asked Sep 11 '12 12:09

alexsmail


People also ask

Does Maven support incremental builds?

Maven builds incrementally by default, but it turns out that the compiler plugin (i.e., the core of javac) is so fast that building fresh every time is not a bottleneck with sane codebase sizes, not by comparison with constructing large assemblies or running large test suites.

Can Jenkins build be triggered automatically?

Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.

How many builds are included in the build trend for each Jenkins job?

Jenkins keeps the last 30 builds of all our jobs.


1 Answers

As stated by Maven documentation incremental builds are not very reliable at least until 3.0.4:

Currently (3.0.4) Apache Maven doesn't support incremental builds very well.

https://cwiki.apache.org/confluence/display/MAVEN/Incremental+Builds (first line)

Instead, I would strongly suggest using any of these two approaches for speeding up your build:

  • Using parallel builds. In my experience in large projects this works great and can greatly reduce the build time with minimum (if any) risk. Just execute something like mvn -T 1.5C clean install https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3

  • If your modules are independent you can rather move them to different projects and glue them together by using maven dependencies.

like image 111
Adrián Deccico Avatar answered Dec 28 '22 18:12

Adrián Deccico