Using Flyway with sbt , how can flywayUrl specified through system properties ( -D ) instead of build.sbt ?
I want to start the migration through the command line, specifying all the parameters (driver, URL, user, password) without defining them in build.sbt .
The plugin documentation page seems to indicate that this should be possible:
Redefinition order
System Properties> Plugin Configuration
I tried to run it as follows:
sbt -Dflyway.url=jdbc:h2:file:target/foobar -Dflyway.user=SA flywayMigrate
But the flyway.url property seems to be ignored in favor of the flywayUrl property defined in build.sbt .
Review of the project with these files:
build.sbt
libraryDependencies ++= Seq( "com.h2database" % "h2" % "1.3.174" ) seq(flywaySettings: _*) flywayUrl := "something that should be overriden"
Project /plugins.sbt
addSbtPlugin("com.googlecode.flyway" % "flyway-sbt" % "2.3") resolvers += "Flyway" at "http://flywaydb.org/repo"
Src / home / resources / db / migration / V1__Create_person_table.sql
create table PERSON ( ID int not null, NAME varchar(100) not null );
Running this command:
$ sbt -Dflyway.url=jdbc:h2:file:target/foobar -Dflyway.user=SA flywayMigrate
Produces this error:
Loading /usr/share/sbt/bin/sbt-launch-lib.bash [info] Loading project definition from /home/fernando/work/scratch/flyway-sbt/foobar/project [info] Updating {file:/home/fernando/work/scratch/flyway-sbt/foobar/project/}foobar-build... [info] Resolving org.fusesource.jansi
scala database-migration sbt flyway
Fernando correia
source share