sbt / sbt-assembly

Deploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
MIT License
1.95k stars 225 forks source link

How to create an sbt task that is assembly without the tests. #369

Open vamsiampolu opened 5 years ago

vamsiampolu commented 5 years ago

I am trying to create a custom task that runs sbt assembly without running any tests.

lazy val assemblyWithoutTest = taskKey[sbt.File]
assemblyWithoutTest := {
  assembly
}

assemblyWithoutTest.settings := {
  assembly.settings
}

test in assemblyWithoutTest := {}

I have seen the issue https://github.com/sbt/sbt-assembly/issues/140 but it does not satisfy the requirement we have been and it should be a separate task.

I also tried this:

import sbtassembly.AssemblyKeys._
assemblyWithoutTest= assemblySettings
test in assemblyWithoutTest := {}

But it does not compile

I have been going through the source code and I found this:

assembly := Assembly.assemblyTask(assembly).value

What is this define and assign? It's really confusing.

philliptaylorpro commented 4 years ago

I concur that sbt assembly shouldn't be running tests. It makes the system less stable and less flexible. You would expect sbt coverage test coverageReport clean compile assembly to make sense as a sequence of actions and binding these together makes the system confusing, inconsistent, slower and more fragile. It's not good design. Do one thing and do it well.