Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build multiproject Gradle on Jenkins

I have a Gradle multiproject hosted in Mercurial repo. I would like to setup my Jenkins in such a way, that if I commit changes into only 1 subproject, then only that subproject will be built and published to my Nexus repo.

Can somebody give me a hint? Or is it at all possible?

like image 521
Nikem Avatar asked Oct 21 '22 19:10

Nikem


2 Answers

We sort of have this working.

We create a project in Jenkins for each gradle subproject. And in the Jenkins configuration we build only the subproject by doing something like:

gradle clean :<subproject>:build

We still have the problem that the job is fired for all checkins to the entire project. I would to configure Jenkins to build only when there's checkin to the subproject, but don't know how to specify this.

like image 185
timwise Avatar answered Oct 25 '22 20:10

timwise


Leaving our final solution for the future here.

We created a separate Jenkins job for each subproject. Jenkins' Mercurial plugin allows to specify "modules":

Reduce unnecessary builds by specifying a comma or space delimited list of "modules" within the repository. A module is a directory name within the repository that this project lives in. If this field is set, changes outside the specified modules will not trigger a build (even though the whole repository is checked out anyway due to the Mercurial limitation.)

This way our jobs are triggered only when change occurred in the monitoring sub-project.

like image 26
Nikem Avatar answered Oct 25 '22 21:10

Nikem