1

I don't wanna create any deployable without running tests. Is there anyway in sbt-native-packager / sbt where I could run sbt test in inside sbt dist, which would fail when any test fails?

N A
  • 831
  • 2
  • 8
  • 28

1 Answers1

2

There are multiple ways to achieve this.

Create a command alias

This is my recommended approach as it is very explicit, easy to understand and extend. In your build.sbt add

addCommandAlias("buildDist", ";  compile ; test ; dist")

Now you can call sbt buildDist

Depend on test

You can add dependencies between tasks. In your build.sbt

dist := (dist dependsOn test).value

This will add the test task as a dependency

Cheers, Muki

Muki
  • 3,513
  • 3
  • 27
  • 50