How to build a multi-project with multiple agents in TeamCity?


The question:

What is the best way to configure project dependencies in a multi-project so that TeamCity builds it with multiple agents simultaneously as opposed to each agent building a complete copy of the whole multi-project by itself which pretty much defeats the whole idea of having multiple agents?

The details:

We have the following type of flat folder multi-project:
– builder
– tools
– generators
– model
– reports
– server
– client
– war

The root project is “builder” and the build order is exactly as listed above - from top to bottom where “builder” gets built first and “war” gets built last.

All project dependencies are configured with gradle’s project referencing, like this:
dependencies {
compile project(":model")


In this way when importing the projects in Eclipse, for example, if project “server” depends on project “model” then project “model” is referenced by project “server” and everything works smoothly. From Eclipse we call Gradle tasks directly and whenever we want to build the “server” project the “model” gets built as well if not up to date.

We want to make TeamCity build the whole multi-project with multiple agents so that it gets built faster, but currently if we do not adjust our gradle scripts to fetch the project artifacts from some in-company repository we can’t make TeamCity utilize all agents.

Any thoughts or maybe some best practices CI friendly gradle build scripts?