How to make a build on a common component trigger other builds dependent on it

Answered

Background:

I have a multi-module maven project which contains a common component called A and other two components called B and C depend on the module A. All the three modules are parallel under a parent pom in the same VCS(git) project.

Configuration on Teamcity:

I create a project with a VCS Roots configured to the git url. And I also create three builds under the project which share the same VCS Roots but with checkout rules each to check out only module A, B, C for each build.

Then, I add Snapshot Dependencies for build B and C to let them depend on build A.

Question:

If only module B or/and module C is changed on VCS, then only build B or/and build C is triggered which works as expected. However, if module A is changed, it only trigger build A but not trigger build B and build C. I know that the snapshot dependencies means the later build will trigger all its ancestor on a chain, but how can I make it vice versa?

2 comments
Comment actions Permalink

Hi Tonny,

 

unless I'm missing something, the only thing you would need is to remove the VCS Trigger from your common build for A, then simply check the checkbox on the triggers for B and C to trigger on changes in snapshot dependencies. Since, as you observed, any trigger on B or C will force a build on A due to the snapshot dependency, if B or C (or both in this case) are configured to trigger when A changes, then those will also force a build from A that will include the newer changes.

 

Could you check if that works for you?

0
Comment actions Permalink

Hi Denis,

Thanks a lot for your kind reply and sorry for my late response.

Your solution works perfectly, and actually I really didn't notice the config option in VCS Trigger to let the module be triggered on changes in dependencies. 

Thanks again!

0

Please sign in to leave a comment.