We’re using Gradle in a large project with a Jenkins pipeline that allows us to scale our build pipeline (e.g. across multiple machines).
What we have now looks like:
- Build everything
- Run basic unit tests
- Run integration tests with single-machine backend on several machines at once (copies project directory elsewhere)
- Run integration tests with distributed backend on several machines at once (copies project directory elsewhere)
- Aggregate test results / reports and publish the build if everything was OK
Note that steps 3 and 4 each consist of parallel gradle builds, each on a different machine. We use multiple machines to run our pipeline in parallel because even with Gradle’s built-in parallel support, it takes far too long to do everything on one machine.
For some reason, when we build on the other machines, Gradle cleans up and re-does all of the work performed by past stages. The file structure does not change and we preserve the “.gradle” directory when copying to other machines. We also propagate the cached gradle jars to a temporary GRADLE_USER_HOME directories on the build machines, but do not preserve the local script cache or anything else.