I have an SBT 0.7.5 project and its some test cases fail. Until all test cases are fixed, I want to skip tests to generate a JAR. Is there any command line argument that tells SBT to skip all tests, like Maven's -Dmaven.test.skip=true
flag?
2 Answers
I had the same problem, I'm using the assembly plugin. In this case, the solution was to modify the build file and add
test in assembly := {}
-
3This should be the marked as the proper answer, cos it tells you how
test
can be made to do nothing in a certain scope. Commented Nov 3, 2015 at 11:37 -
3This changes the build file though, which isn't how I would want to skip tests - the maven command line flag is a more useful version, but it appears there is no (sbt-) run-time option to skip tests. Commented Apr 6, 2017 at 7:00
-
Indeed, this can also be done at-runtime-only using the
set
keyword of sbt, likesbt 'set test in assembly := {}' clean assembly
. See kshakir's answer from How run sbt assembly command without tests from command line?– MurmelCommented Apr 16, 2018 at 17:24 -
Hi, when I add this to build.sbt I get the error: error: not found: value assembly running sbt assembly words just fine. Commented Apr 7, 2020 at 19:44
Instead of using compile
, you could use package
. The compile tasks also runs the tests, package doesn't.
-
2
-
6Despite it works in several circumstances, this answer does not really answer the question. A proper answer should say how you can disable tests in a certain scope, instead of directing you to employ another task, instead of
test
. Commented Nov 3, 2015 at 11:36