Changing Tomcat Dependency Versions in Gradle

If your Spring Boot app isn’t successfully deploying as a WAR package you may be having a Tomcat version conflict. More specifically, Tomcat dependencies in your application are a newer version than your Tomcat server.

Let’s say your Tomcat Server is 8.0.8. Your Spring Boot Starter v1.2.3 uses Tomcat libraries with version 8.0.20. Here’s how to control the version of those dependencies in Gradle. You need a recent Gradle release to use resolutionStrategy (I’m using Gradle 2.5), but the key is configurations.runtime. No other configuration will do.

If we look at our WEB-INF/lib contents we’ll see 8.0.8 across the board!