Closed pjrt closed 5 years ago
I closed my PR since it would require a major change. If anyone wants a pretty simple work around, simply add this plugin to your project.
import sbtassembly._
object OnDemandAssemblyPlugin extends AutoPlugin {
override def requires = AssemblyPlugin
override def trigger = noTrigger
import autoImport._
import AssemblyKeys._
override def projectSettings =
Seq(
onDemandAssembly := assembly.value
)
object autoImport {
val onDemandAssembly = taskKey[File]("An on-demand assembly")
}
}
We have a multiple-project project where we use assembly for building fat jars. Now of course, we only build fat jars for projects which can be ran (executables), as making a fat jar for a library project wouldn't make sense.
However, I realized that because the Assembly plugin requires the JvmPlugin, it is added to ALL projects.
https://github.com/sbt/sbt-assembly/blob/master/src/main/scala/sbtassembly/AssemblyPlugin.scala#L7
I am aware of
disablePlugins
, but since we have way more library projects than we have executable projects, we would like to do the opposite: to have the plugin ONLY enabled on projects we deem need it.Is there a way to do this?