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

2

12

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.

Sumac answered 25/4, 2012 at 14:41 Comment(0)
S
4

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

Sumac answered 20/6, 2012 at 20:36 Comment(2)
You can try open project and select Modules from left menu, but it does not build a whole tree od that module. So it's useless.Townsville
As of 2021, it looks to be implemented in Jenkins 2.7, moving forward. Can anyone else verify that the fix is in, and is working as expected?Sparrowgrass
D
1

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.

Difficult answered 4/5, 2012 at 13:35 Comment(2)
Thank you; yes; I use that extensively. It's not quite the same thing, unfortunately.Sumac
Well, that's the only thing there is right now. You can always go, in a multi-module project, to a section in the right navigation menu called Modules and you can try to re-run any module. But in my case - even that does not work every time...Avionics

© 2022 - 2024 — McMap. All rights reserved.