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

Gradle: Unable to instantiate JDBC driver declared as buildscript dependency #1539

sergey-selivanov opened this issue Feb 24, 2017 · 2 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)

Gradle plugin

What database are you using (type & version)?

MariaDB 5.5.52

What operating system are you using?

MariaDB server on CentOS, grable build on Windows 8

What did you do?

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

trying to run flywayInfo, flywayMigrate tasks. It worked with all Flyway versions from 4.0 to 4.1.0 and now fails with 4.1.1

What did you expect to see?

Succesful build

What did you see instead?

Build fails with "Unable to instantiate JDBC driver: com.mysql.cj.jdbc.Driver : com.mysql.cj.jdbc.Driver".

This looks very similar to the issue #1527 , the difference is that we're using mariadb jdbc driver, and dependence is declared via buildscript->dependencies:

buildscript {
    repositories {
        maven {
    dependencies {
        classpath 'org.flywaydb:flyway-gradle-plugin:4.1.0'    // 4.1.1 fails with "unable to instantiate jdbc driver com.mysql.cj.jdbc.Driver"
        //classpath 'mysql:mysql-connector-java:5.1.38'
        classpath 'org.mariadb.jdbc:mariadb-java-client:1.5.8'

apply plugin: 'org.flywaydb.flyway'
@axelfontaine axelfontaine added this to the Flyway 4.1.2 milestone Feb 24, 2017
@axelfontaine axelfontaine changed the title Unable to instantiate JDBC driver: com.mysql.cj.jdbc.Driver Gradle: Unable to instantiate JDBC driver declared as buildscript dependency Mar 3, 2017
axelfontaine pushed a commit to flyway/ that referenced this issue Mar 3, 2017
Copy link

dzwicker commented Sep 4, 2018

So why you close this issue? In your commit there is nothing about the buildscript-block and loading any classpath dependencies from it. It works not with 5.1.4. And not all project have compile, runtime or other java dependency configuration in gradle. Only java based project have these scope by default. So please adjust your Docu or fix this bug or provide some comment what users should do if they upgrade...

Copy link

@dzwicker Please file a new issue with clear steps how to reproduce.

@flyway flyway locked as resolved and limited conversation to collaborators Sep 4, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
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