WestCoastProjects
WestCoastProjects

Reputation: 63201

How to skip tests in all phases of sbt builds (or maybe just in publish)

A typical answer about how to skip tests in sbt would be:

 sbt "set test in assembly := {}"

However when I run for example

sbt publishLocal

Then that approach does not work. Is there a global "disable" tests flag like

maven -Dmaven.skip.test=True

Or if not .. what would be the way to disable tests just for publishLocal ?

Upvotes: 3

Views: 3435

Answers (1)

Justin Kaeser
Justin Kaeser

Reputation: 5948

You could disable the test task in the global scope on the sbt shell like this:

set test in ThisBuild := println("tests disabled")

Usually publishLocal does not depend on the test task at all, unless you or a plugin are overriding the task. You can check in the sbt shell to see where it is defined and if there is a dependency on test:

inspect publishLocal

or for the full dependency tree

inspect tree publishLocal

It's possible that it is overriden to indirectly depend on test in another scope, in which case you can override it there.

Upvotes: 2

Related Questions