Why does Gradle downgrade my transitive dependencies in a Grails 3.1 application?

Goto your Gradle cache files folder:

cd ~/.gradle/caches/modules-2/files-2.1

search this version number:

grep -r "3.2.1" *

you will find out which pom file is using this version, usually it's something in spring-boot-dependencies-x.y.z.RELEASE.pom :

<flyway.version>3.2.1</flyway.version>
......
<groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>${flyway.version}</version>
</dependency>

which means, if you use spring-boot, it will overwrite some dependency version.

you can overwrite it again, by adding the following line in your gradle.properties file:

flyway.version=4.0.1

I encounter a similar problem and wasted several hours on it. So I left this information here, hope this could save your time if you get stuck into this problem


The thing causing it is the spring-boot-dependencies-1.3.3.RELEASE.pom

This forcing the flyway version to 3.2.1

According to the Spring Boot docs you should be able to add a line like this to your build.gradle: ext['flyway.version'] = '4.0.1'