Building plugins for multiple versions of sbt is often cumbersome because just to build a version of your plugin for another version of sbt you have to change the sbt version of your plugin build. This hinders fast adoption of new sbt versions because just to release a backwards compatible version of your plugin all the build plugin dependencies have to be available for every version sbt you want to build for.
This plugin tries to ease the building of plugins for older versions of sbt.
addSbtPlugin("net.virtual-void" % "sbt-cross-building" % "0.6.0")
project/plugins.sbt and you are ready to go.
sbtVersion in sbtPluginsets the target sbt version for your plugin
^^command in the sbt shell to set the sbt version you want to build against. For example, sbt version 0.11.0 is selected by running
in the sbt console. That's basically equivalent to running
set sbtVersion in sbtPlugin := "0.11.0"
CrossBuilding.crossSbtVersionssetting to a list of sbt versions to build against and then use
^ <command>to execute an sbt command for each of the sbt versions listed.
- You can have custom (scala) source directories for particular versions of sbt. Currently, both
sbt/main/scala-sbt-0.x.yare supported. E.g. a source directory
src/main/scala-sbt-0.11.2will only be used when building against sbt 0.11.2, a source directory
src/main/scala-sbt-0.11will be used for any version of sbt 0.11.x.
- You can build 0.12.0-Beta2 plugins from sbt 0.11.x. The right scala version will be chosen automatically from the version selected.
- The scripted plugin shipping with sbt is incompatible with sbt-cross-building because
it uses the wrong sbt launcher. This plugin contains a fixed version of the scripted plugin. To make
- remove the
plugins.sbtdependency on the scripted plugin
- remove the
- To allow building against other versions of sbt we have to rewrite a bunch of settings which are already defined in sbt itself. This may lead to issues, however, we've not experienced any such yet.
Copyright (c) 2012 Johannes Rudolph
Published under the BSD 2-Clause License.