'FlyWay plugin with sbt

I'm trying to apply FlyWay plugin by sbt build configuration.

In plugins.sbt

In my build.sbt:

lazy val CustomConfig = config("custom") extend Runtime
lazy val customSettings: Seq[Def.Setting[_]] = Seq(
   flywayUser := "andrej",
   flywayPassword := "123456",
   flywayUrl := "jdbc:postgresql://localhost:5432/database",
   flywayLocations += "db/migration"
 )

lazy val flyWay = (project in file("."))
   .settings(inConfig(CustomConfig)(FlywayPlugin.flywayBaseSettings(CustomConfig) ++ 
customSettings): _*)

In resources.db.migration-directory sql-file is created.

And trying to run migration to database it with command: sbt flywayMigrate But it returns the following errors:

[error] Expected ';'
[error] Not a valid command: flywayMigrate
[error] No such setting/task
[error] flywayMigrate
[error]              ^


Solution 1:[1]

Looks like you did not enable the plugin.

Add following line to your project/plugin.sbt

addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % "7.4.0")

and enable the plugin in you build.sbt file:

enablePlugins(FlywayPlugin)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 senjin.hajrulahovic