Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

scala

sbt

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 ?

like image 899
WestCoastProjects Avatar asked Jan 31 '26 14:01

WestCoastProjects


1 Answers

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.

like image 135
Justin Kaeser Avatar answered Feb 03 '26 09:02

Justin Kaeser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!