sbt - Conditional addSbtPlugin based on scalaVersion -
i'm using plugin (sbt-scapegoat) works scala 2.11.
can have conditional addsbtplugin based on scalaversion? like:
if (scalaversion.value.startswith("2.11")) addsbtplugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "0.94.6")
how can in sbt?
jianshi
tl;dr it's not possible given description of problem.
there at least 2 build configurations involved in sbt project - real project (you want bet money on) , meta build build of project. yes, know sounds little weird, it's powerful concept imho.
see sbt recursive:
the project directory build inside build, knows how build build. distinguish builds, use term proper build refer build, , meta-build refer build in project. projects inside metabuild can other project can do. build definition sbt project.
sbt runs atop scala , requires strict version of it. no way change unless fancy spending time on things should not touching in first place :)
what can apply plugin in project/plugins.sbt
, then, in project, apply the settings of plugin selectively, per scalaversion
of project's build not meta-build's itself.
it's not complicated answer reads, explaining simple concepts not easy task me. have fun sbt! it's gonna pay when used properly.