Search code examples
pluginssbtsbt-assemblysbt-pluginscala-version-cross-build

when specify the scalaVersion and sbtVersion to resolve the plugin dependencies via “extra”,it doesn't work


I'm trying to add a plugin like this :

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2" extra ("scalaVersion" -> "2.10", "sbtVersion" ->  "0.13"))

But when I start sbt session ,the search path still be

https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0//0.11.2/ivys/ivy.xml

the scalaVersion and sbtVersion still is the one which I'm using.

Could you tell me What should I do?

Thank you!


Solution

  • That is what addSbtPlugin does: it adds the appropriate scalaVersion and sbtVersion to the mentioned artifact (in your case overriding what you have specified manually).

    If you want to have full control, do not use addSbtPlugin:

    libraryDependencies += "com.eed3si9n" % "sbt-assembly" % "0.11.2" extra ("scalaVersion" -> "2.10", "sbtVersion" ->  "0.13")
    

    BUT beware, usually this sort of thing will not work if you fail to add the right attributes appropriate for your SBT version at hand.

    In your case, you are apparently using SBT 1.x, which in turn uses Scala 2.12. Trying to use an artifact build with Scala 2.10, ie. for SBT 0.13.x, will break.