Multi Module Maven simultaneous build steps

Answered
  • proj_API (poll SVN)

          I want to build this when it detects changes in the repo.

  • proj_B->H

          These all have maven dependencies on proj_API and need to always use the latest build artifact from proj_API. They also have their own                code that is independent of proj_API. I assume I can just use SVN polling with VCS Triggers with some rules.

  • proj_Final

          This project should be triggered if anything changes in proj_B->H but only if all of proj_B->H have finished. I think that this means I should             have some kind of logic that checks to see if there are pending builds.If there are no pending build it should fire, otherwise wait until they               finish. Is this possible?

 

 

I have a multi-module maven project that has A->H modules. All modules B->H have a dependency on A and cannot build until A has finished. I would like B->H to build simultaneously after A finishes successfully. Is this a job for multiple build agents or it is something far simpler.

To give some context my maven project A is all the code defining my API. The other projects are various ways that I expose this API. Each sub project uses the API project as its' fundamental requirement but they don't need to know anything about the other B->H components, so they could be built simultaneously... once A finishes.

Finally, I want to use a build configuration to gather all the single artifacts for everything A->H and use them to build an installer. So that means I need some kind of build trigger to kick this job off. It should grab all the latest artifacts (dependencies for this Final build?) from A->H and use those to build an installer from a "Command Line" build step.

0
3 comments

You can set all your B-H builds to have a snapshot dependency on A and your installer build to have a snapshot + artifact dependency on all your B-H builds. You can then remove the VCS triggers from all your A-H, and add them exclusively to your installer build. When the installer build is triggered, it will bring all the dependencies recursively to be built as well into the queue and the A will get built (if needed) first, then B-H with pending changes will get built, then the installer will get all the artifacts and build. TeamCity will make sure to respect the dependencies as you assigned them. Behavior upon failure can also be configured in the dependencies.

You also have the option to keep the VCS triggers in B-H if you want to trigger them independently, and can add a "Finish Build Trigger" to the installer build to be triggered on specific (or all) of this builds.

As you can check on our Documentation (https://confluence.jetbrains.com/display/TCD10/Build+Agent), a given build can only run in a single build agent, so the only option to parallelize the builds is to run multiple agents (you can run multiple agents in the same computer)

I think this would be the easiest way to achieve what you are looking for. If I missed something, please don't hesitate to ask.

0

Thank you so very much for this direction. Perfect answer and much needed help. Plus, it helps give a little confidence in that we are doing it right.


 


 

0

Simultaneous builds can only happen in different build agents. Once the builds are on the queue, free agents will take them as soon as all their dependencies are ready, so if you trigger a build with the installer and all dependant builds are dragged onto the queue, first only A will get built and the rest will stay in the queue (independently of how many agents you have), then B-H will get split among all the available agents until they are finished, then the installer will start once B-H are all done.

Again, to parallelize B-H (or any kind of build at all) you need to install more build agents, be it on the same device or others. A single agent can only run one build at a time. For more information, please check the Docs here: https://confluence.jetbrains.com/display/TCD10/Build+Agent

0

Please sign in to leave a comment.