99

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?

2
  • based on this and that, and the official documentation I'd say no. Either you have to modify the build files or execute package as that doesn't run any tests.
    – DB5
    Commented Oct 22, 2014 at 7:00
  • Possible duplicate of How can I skip tests in an SBT build?
    – Murmel
    Commented Apr 16, 2018 at 17:19

1 Answer 1

179

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
6
  • 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.
    – kshakir
    Commented Aug 2, 2015 at 15:54
  • 1
    On 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?
    – Metropolis
    Commented Aug 25, 2015 at 20:02
  • 13
    That might not be a sbt version problem, but due to an older sbt-assembly. Try the more universal "set test in Test := {}". What version of sbt-assembly is listed within your plugins 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.
    – kshakir
    Commented 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
  • 2
    If you're doing this inside an sbt prompt, run them as three individual tasks, with no quotes: set test in Test := {}, clean, assembly
    – mcw
    Commented Jan 9, 2019 at 20:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.