I want to write the flyway connection detail to a file, so I can use these values in a custom JavaExec task. If you want to know more about it you can read: How to run a JavaExec gradle task with arguments when the task is called in finalizedBy?
I created a task that writes the url, user and password to a file and it works, but the problem is that it is always using the default values from the flyway {} block in the build.gradle file and ignores the overridden values in case flywayMigrate is run with props like this:
./gradlew flywayMigrate -Pflyway.user=admin -Pflyway.password=secret
Below you can see the task that writes the values to the file.
task writeArgstoFile {
doFirst {
mkdir "$rootProject.buildDir/check-db-standards"
new File("${rootProject.buildDir}/check-db-standards/args").text = "${flyway.url}\n" +
"${flyway.user}\n" +
"${flyway.password}\n"
}
}
flywayMigrate.finalizedBy(writeArgstoFile)
writeArgstoFile.finalizedBy(rootProject.checkOracleStandards)
How can I get the correct updated flyway values?