Skip to content

andyrbell/flyway-spring-migration

Repository files navigation

Flyway SpringJdbcMigration Problem

This project is an attempt to replicate this issue described on Stack Overflow.

The problem occurs with Flyway 4.1.2.

The spring-jdbc library needed to be added to the buildscript dependencies to get it working with 4.1.2.

It does work for Flyway 4.0.3 without this explicit dependency. Not sure why.

It is worth noting that the flyway-gradle-plugin was converted to java from groovy between these versions.

Running

Optionally, use the included docker-compose.yml to spin up a mysql container. (Requires docker and docker-compose, see the Installation Guide)

docker-compose up -d

Alternatively, update the database settings in build.gradle as appropriate to point to an existing database.

Run the Flyway migration as follows:

./gradlew build flywayMigrate --stacktrace

Error

To replicate the error, comment out the following line in build.gradle and re-run.

classpath("org.springframework:spring-jdbc:${springVersion}")

On the first run, it will give the following error

java.lang.NoClassDefFoundError: org/springframework/jdbc/core/JdbcTemplate

On all subsequent runs it will give the loader constraint violation described in the issue.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages