Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I trigger a Jenkins build of a single module in a multi-module Maven build from Subversion?

Tags:

jenkins

I have a big Maven multi-module build set up in my Jenkins. It is set up for incremental builds.

When triggered, it parses all the POMs and figures out what it needs to build.

It is currently set up to trigger on SCM changes.

I would like to make this build so that I can do the following:

  • Still start it manually. When I do this, its incremental build behavior would function as it does today.
  • Trigger the build from a Subversion commit hook. I'd like to know that if I go to the trouble of setting up the commit hook via the excellent instructions that it will not cause the build to go to unnecessary lengths to poll the SCM or do other work that is rendered unnecessary by the fact that the commit hook is telling it what has changed.

I mention the second point because from my looking at the documentation, this appears to simply poke the general build and let it do its thing. (I might be wrong.) I'd rather have it tell Jenkins exactly what has changed and have Jenkins just "know" what modules those changed repository paths map to, so that Jenkins doesn't have to do polling or extra pom.xml parsing to figure it out.

I am quite prepared to have someone who has been through this war to tell me, look, just go set up the Subversion commit hook and that's as good as you're going to get, but I'm asking this question in case there's a better recipe.

like image 915
Laird Nelson Avatar asked Apr 25 '12 14:04

Laird Nelson


2 Answers

This facility does not yet apparently exist in Jenkins when working with Maven 3 builds.

like image 140
Laird Nelson Avatar answered Sep 22 '22 06:09

Laird Nelson


Did you tried the Incremental build - only build changed modules option in Build section in project configuration? In this case the repository will notify Jenkins of a change submitted, the SCM plugin will check-out the files and the Maven plugin will try to guess which modules needs a rebuild. It works in most cases in my environment, although it's not 100% proof.

like image 25
Łukasz Rżanek Avatar answered Sep 22 '22 06:09

Łukasz Rżanek