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?
Asked
Active
Viewed 6.3k times
99
-
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 Oct 22 '14 at 07:00
-
Possible duplicate of [How can I skip tests in an SBT build?](https://stackoverflow.com/questions/9763543/how-can-i-skip-tests-in-an-sbt-build) – Murmel Apr 16 '18 at 17:19
1 Answers
178
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. – kshakir Aug 02 '15 at 15:54
-
1On a Mac, sbt 0.13.7 I get
:1: error: not found: value assembly [error] Type error in expression" Is this really an issue of 13.7 vs 13.8? – Metropolis Aug 25 '15 at 20:02 -
13That 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](https://github.com/sbt/sbt-assembly/tree/0.11.2#assembly-task) & [0.13.0](https://github.com/sbt/sbt-assembly/tree/0.13.0#assembly-task) 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 Aug 26 '15 at 04:45
-
8`sbt 'set test in assembly := {}' clean assembly` still runs scalatest Specs on macos/ `sbt 1.0` – prayagupa Dec 08 '18 at 05:47
-
adding `test in assembly := {}` to `module2/build.sbt` not `root/build.sbt` is working as mentioned in https://github.com/sbt/sbt-assembly. need to find equivalent in terminal – prayagupa Dec 28 '18 at 20:33
-
2If you're doing this inside an `sbt` prompt, run them as three individual tasks, with no quotes: `set test in Test := {}`, `clean`, `assembly` – mcw Jan 09 '19 at 20:59