Auto plugins are available only for sbt 0.13.5 and above.
In accordance to revised plugin best practice guide, all keys introduced by sbt-assembly are now prefixed with "assembly" or "assemble."
So, for example jarName
becomes assemblyJarName
, and mergeStrategy
becomes assemblyMergeStrategy
. For easier migration, the older key names are deprecated but still kept in the plugin for 0.12.0. See AssemblyKeys.scala
If you are using multi-project build.sbt
(before):
import AssemblyKeys._
lazy val commonSettings = Seq(
version := "0.1-SNAPSHOT",
organization := "com.example",
scalaVersion := "2.10.1"
)
lazy val app = (project in file("app")).
settings(commonSettings: _*).
settings(assemblySettings: _*).
settings(
// your settings here
)
- Remove
import AssemblyKeys._
. The keys are now auto imported. - Remove
settings(assemblySettings: _*).
. The settings are now auto injected to all projects withJvmPlugin
.
Here's how build.sbt looks now:
lazy val commonSettings = Seq(
version := "0.1-SNAPSHOT",
organization := "com.example",
scalaVersion := "2.10.1"
)
lazy val app = (project in file("app")).
settings(commonSettings: _*).
settings(
// your settings here
)
Here's how assembly.sbt
at the root directory would've looked (before):
import AssemblyKeys._ // put this at the top of the file
assemblySettings
// your assembly settings here
- Remove
import AssemblyKeys._
. The keys are now auto imported. - Remove
assemblySettings
. The settings are now auto injected to all projects withJvmPlugin
.
Here's how assembly.sbt
now looks:
// your assembly settings here
In other words, we no longer need assembly.sbt
unless you need additional settings.
Here's how build.scala
would've looked (before):
import sbt._
import Keys._
import sbtassembly.Plugin._
import AssemblyKeys._
object Builds extends Build {
lazy val commonSettings = Defaults.defaultSettings ++ Seq(
version := "0.1-SNAPSHOT",
organization := "com.example",
scalaVersion := "2.10.1"
)
lazy val app = Project("app", file("app"),
settings = commonSettings ++ assemblySettings) settings(
// your settings here
)
}
The recommended route of upgrade is to go to multi-project build.sbt
.
If you want to stay on build.scala
for whatever reason, it would look like multi-project build.sbt
with object
around it.
- Replace imports of
sbtassembly.Plugin._
andAssemblyKeys._
withsbtassembly.AssemblyPlugin.autoImport._
. - Drop
Defaults.defaultSettings
from commonSettings. - Use
settings()
method to appendcommonSettings
.
import sbt._
import Keys._
import sbtassembly.AssemblyPlugin.autoImport._
object Builds extends Build {
lazy val commonSettings = Seq(
version := "0.1-SNAPSHOT",
organization := "com.example",
scalaVersion := "2.10.1"
)
lazy val app = (project in file("app")).
settings(commonSettings: _*).
settings(
// your settings here
)
}