Build multiproject Gradle on Jenkins
Asked Answered
C

3

6

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?

Confect answered 14/1, 2013 at 10:29 Comment(0)
C
1

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.

Confect answered 27/5, 2016 at 6:35 Comment(0)
H
2

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.

Herl answered 12/2, 2015 at 14:32 Comment(0)
C
1

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.

Confect answered 27/5, 2016 at 6:35 Comment(0)
A
0

I guess you need to create a project in jenkins for each subproject.

Other option would be to find if there is a way to intercept the repo sync and see what subproject has changed and do the build dynamically.

Annorah answered 21/3, 2013 at 5:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.