I have read questions: this and that. They suggest to modify sbt file. But I want run sbt clean assembly
without tests and do not modify sbt build files. Is it possible with sbt? In maven there is -DskipTest=true
parameter, is there analog for sbt?
1 Answer
For any properties you need to change on the command line, prepend them with "set ", and wrap them in quotes.
Example for Windows:
sbt "set test in assembly := {}" clean assembly
Example for Mac:
sbt 'set test in assembly := {}' clean assembly
-
Edited. Quoting is quite different in windows, so tried to make this answer generic enough to get folks started by just using double quotes for this specific answer. In general, the principle is that you want to pass a single argument, often unescaped, to
sbt
with your entire "set …". Also note you can pass multiple "set " statements as separate command line arguments, or by semicolon separating the statements within one quoted argument.– kshakirCommented Aug 2, 2015 at 15:54 -
1On a Mac, sbt 0.13.7 I get <set>:1: error: not found: value assembly [error] Type error in expression" Is this really an issue of 13.7 vs 13.8? Commented Aug 25, 2015 at 20:02
-
13That might not be a
sbt
version problem, but due to an oldersbt-assembly
. Try the more universal"set test in Test := {}"
. What version ofsbt-assembly
is listed within yourplugins
directory? The docs for both 0.11.2 & 0.13.0 both say to use the same above syntax within the build.sbt. But I'm guessing perhaps when using the older plugin that setting may not be available via the sbt console, and hence not on the command line.– kshakirCommented Aug 26, 2015 at 4:45 -
8
sbt 'set test in assembly := {}' clean assembly
still runs scalatest Specs on macos/sbt 1.0
Commented Dec 8, 2018 at 5:47 -
2If you're doing this inside an
sbt
prompt, run them as three individual tasks, with no quotes:set test in Test := {}
,clean
,assembly
– mcwCommented Jan 9, 2019 at 20:59
package
as that doesn't run any tests.