How can I run sequential tasks that come from a plugin such as flyway before running a test, for example if I wanted to run:
flywayClean
then flywayMigrate
then integrationTests
, how would I do that?
The problem is that sbt doesn't really support anything with side-effects like a db.
I looked at examples of sequencing tasks here: http://eed3si9n.com/sequencing-tasks-with-sbt-sequential
I've tried working through these, and I can follow the basic example, but I can't figure out how to run a task from a plugin such as flyway
.
It seems like part of the problem is that flywayClean
and flywayMigrate
are both of type TaskKey[Unit]
, where the sbt-sequential examples are using Def.Setting[Task[Unit]]
.
sbt has so much complexity that I can't quite figure out how to resolve the Task
associated with a given TaskKey
and then transform that into a Setting[Task[Unit]]
.
Here is how you can have a task that executes a lot of other tasks sequentially. Is this what you want to do? If the tasks are from a plugin you need to bring it into scope. If it's from an auto-plugin then pretty much all its task should be in scope without you explicitly importing them.