Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyway Maven Plugin can't find JDBC driver if the driver is a dependency with scope provided #1923

sparsick opened this issue Feb 13, 2018 · 4 comments


Copy link

What version of Flyway are you using?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Maven Plugin with following Maven Version

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00)
Maven home: /home/sparsick/.sdkman/candidates/maven/current
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /home/sparsick/.sdkman/candidates/java/8u151-oracle/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "4.13.0-32-generic", arch: "amd64", family: "unix"

What database are you using (type & version)?

MySql 5.7.21-0ubuntu0.16.04.1

What operating system are you using?

Ubuntu 16.04 LTS based

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

I updated Flyway Version from 4.0.3 to 5.0.7. Following POM configuration, that works with 4.0.3, stopped working if calling mvn flyway:migrate




After changing the scope of mysql-connector-java to 'compile' mvn flyway:migrate runs sucessfully

What did you expect to see?


What did you see instead?

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building database-scripts 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- flyway-maven-plugin:5.0.7:migrate (default-cli) @ database-scripts ---
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.725 s
[INFO] Finished at: 2018-02-13T12:09:12+01:00
[INFO] Final Memory: 13M/370M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:5.0.7:migrate (default-cli) on project database-scripts: org.flywaydb.core.api.FlywayException: Unable to instantiate JDBC driver: com.mysql.cj.jdbc.Driver => Check whether the jar file is present -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

@sparsick sparsick changed the title Fylway Maven Plugin can't find JDBC driver if the driver is a dependency with scope provided Flyway Maven Plugin can't find JDBC driver if the driver is a dependency with scope provided Feb 13, 2018
@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Feb 13, 2018
axelfontaine pushed a commit to flyway/ that referenced this issue Feb 13, 2018
Copy link

Thanks for the detailed report. Fixed.

Copy link

My pleasure. Thanks for this fast fix.

Copy link


Had the same problem in version 5.2.0 with mysqlconnector-connector for java in a spring boot project. Migrated to 5.1.0 and no issues, just so you know.

Thanks for the awesome tool.


Copy link

axelfontaine commented Oct 18, 2018

@Miguel349 We can't reproduce this with 5.2.0. If the issue persists, please file a new issue with exact steps how to reproduce.

@flyway flyway locked as resolved and limited conversation to collaborators Oct 18, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
…driver is a dependency with scope provided
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants