Flyway: Add flyway.configFiles support to Gradle plugin

Created on 21 Mar 2017  路  3Comments  路  Source: flyway/flyway

What version of Flyway are you using?

4.1.2 version

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)?

Oracle 11.2.0.4

What operating system are you using?

Windows 2010

What did you do?

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

The flyway.configFile cannot be found.

The command is the following:

gradle flywayInfo -Dflyway.configFile=flyway.local.properties
What did you expect to see?

The information about the pending migrations or added.
It works with the Maven plugin version, but not with the Gradle plugin version

What did you see instead?
Unknown configuration property: flyway.configFile
:myProject:flywayInfo FAILED
:myProject:flywayInfo (Thread[Daemon worker Thread 8,5,main]) completed. Took 1.713 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':myProject:flywayInfo'.
> Error occurred while executing flywayInfo
Unable to connect to the database. Configure the url, user and password!

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED
Gradle fixed feature

Most helpful comment

We have now added support for flyway.configFiles which also supports multiple config files.

All 3 comments

It would be nice to do something like this as well:

flyway {
    configFile = file("myFlyway.properties")
}

We have now added support for flyway.configFiles which also supports multiple config files.

Trying to use the flyway.configFiles with gradle plugin in intelliJ for a springboot application. The configuration is as shown below

flyway

the below error comes on trying to build

Executing task 'flywayMigrate -x test -Dflyway.configFiles=flyway.properties'...

Task :flywayMigrate FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':flywayMigrate'.

    Error occurred while executing flywayMigrate
    Unable to load config file: /home/user/Workspace/sample/flyway.properties

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Was this page helpful?
0 / 5 - 0 ratings