Why Spring Boot Switched to Gradle and Cut Build Times by 80%
Spring Boot’s 2.3.0 release marked a major shift from Maven to Gradle, driven by the need to reduce build times, leverage incremental and parallel builds, and improve CI efficiency, resulting in average build times dropping from over an hour to just over nine minutes.
Why Switch
The Spring Boot team moved from Maven to Gradle primarily to reduce the time required to build projects. Longer build times slowed error fixing and feature implementation, and attempts to speed up Maven builds with parallelism failed due to the complexity of the Invoker plugin.
Gradle offered incremental builds, parallel execution, and build caching—benefits observed in other Spring projects using Gradle—prompting the switch.
How to Switch
Gradle’s flexibility makes its builds harder to maintain and understand compared with Maven. To avoid overly complex configurations, the team kept the "convention over configuration" principle, avoiding imperative logic in
build.gradleand creating small reusable plugins in
buildSrc. No major build issues were found in the four Spring Boot 2.3 milestones.
Key Spring Boot features follow "convention over configuration" and were applied to the build system, using lightweight plugins in
buildSrc.
Although the Gradle ecosystem for Spring Boot was initially sparse, the migration removed nearly 9,500 lines of code from the repository.
Switch Results
Build time reductions are evident: a full Maven build on CI or a developer machine took an hour or more, while the average successful Gradle build completed in 9 minutes 22 seconds.
More detailed performance data can be found on Spring Boot’s public Gradle Enterprise instance.
Beyond speed, the team explored other features such as test stability. Unstable tests caused more build failures than expected; using Gradle’s test splitting helped replace the generic CI test strategy and provided insight into issue resolution.
Conclusion
CI builds now average about 20 minutes—3 to 4 times faster—while local builds average 2 minutes 30 seconds, 20 to 30 times faster than before.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.