build.sbt
ScriptedPlugin.scriptedSettings
sbtPlugin := true
project/plugin.sbt
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
project/build.properties
sbt.version=0.13.16-M1
execute sbt "^^ 1.0.0-RC1" scrpted
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-RC1
scala.MatchError: 1.0 (of class java.lang.String)
at sbt.ScriptedPlugin$$anonfun$15.apply(ScriptedPlugin.scala:105)
at sbt.ScriptedPlugin$$anonfun$15.apply(ScriptedPlugin.scala:104)
at sbt.EvaluateSettings$MixedNode.evaluate0(INode.scala:175)
at sbt.EvaluateSettings$INode.evaluate(INode.scala:135)
at sbt.EvaluateSettings$$anonfun$sbt$EvaluateSettings$$submitEvaluate$1.apply$mcV$sp(INode.scala:69)
at sbt.EvaluateSettings.sbt$EvaluateSettings$$run0(INode.scala:78)
at sbt.EvaluateSettings$$anon$3.run(INode.scala:74)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[error] scala.MatchError: 1.0 (of class java.lang.String)
[error] Use 'last' for the full log.
sbt.CrossVersion.binarySbtVersion("1.0.0-RC1") returns "1.0" (in sbt 0.13.16-M1 and sbt 1.0.0-RC2) https://github.com/sbt/sbt/blob/v0.13.16-M1/util/cross/src/main/input_sources/CrossVersionUtil.scalaworkaround
build.sbt
ScriptedPlugin.scriptedSettings.filterNot(_.key.key.label == libraryDependencies.key.label)
sbtPlugin := true
libraryDependencies ++= {
CrossVersion.binarySbtVersion(scriptedSbt.value) match {
case "0.13" =>
Seq(
"org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % scriptedConf.toString,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString
)
case _ =>
Seq(
"org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % scriptedConf.toString,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString
)
}
}
sbt.CrossVersion.binarySbtVersion("1.0.0-RC1") returns "1.0" (in sbt 0.13.16-M1 and sbt 1.0.0-RC2)
sbt 1.0.0-RC2 will keep binary compatibility with 1.0.0 final? if not, sbt plugin authers should not publish any sbt plugins use sbt 0.13.16-M1, 1.0.0-RC2 for prevent binary compatibility issue. sbt generate following pom.xml in target/scala-2.12/sbt-1.0/foo-0.1-SNAPSHOT.pom if set ^^ 1.0.0-RC2
<properties>
<scalaVersion>2.12</scalaVersion>
<sbtVersion>1.0</sbtVersion>
</properties>
https://gitter.im/sbt/sbt-contrib?at=596c57230de4d2545e352519
we intend to keep 1.0.0-RC2 bincompat with 1.0.0 final
that's how Mark Harrah shipped previous versions of sbt
and that's how CrossUtil is coded for sbt
Most helpful comment
workaround
build.sbt