How to inform SBT to consume specific scala version for plugins?

Viewed 14273

Now I somehow messed up my global sbt plugins (~/.sbt/plugins/build.sbt). They were always fine retrieved against Scala 2.9.1 which seems to be the version that sbt 0.11.3 wants, and all the plugins (sbt-gpg-plugin, sbt-idea-plugin) are published against 2.9.1.

Now whatever I do, it persistently tries to find them built against 2.9.2:

[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.github.mpeltonen:sbt-idea:1.0.0 (sbtVersion=0.11.3, scalaVersion=2.9.2)
[warn]      com.jsuereth:xsbt-gpg-plugin:0.6 (sbtVersion=0.11.3, scalaVersion=2.9.2)
...
[error] {file:...}default-50be6e/*:update: sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea;1.0.0: not found

How can I fix this, so sbt retrieves the plugins for Scala 2.9.1 as before?


For the sake of completeness, this is how my files look after the suggestions:

// project-home/build.sbt
scalaVersion := "2.9.2"
...

 

// project-home/project/plugins.sbt
resolvers += "less is" at "http://repo.lessis.me"

addSbtPlugin( "me.lessis" % "ls-sbt" % "0.1.1" )

scalaVersion := "2.9.1"  // "just in case it helps"

 

// ~/.sbt/plugins/build.sbt
scalaVersion := "2.9.1"  // "just in case it helps"

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

resolvers += Resolver.url( "sbt-plugin-releases", url( "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases" ))( Resolver.ivyStylePatterns )

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")

addSbtPlugin( "com.jsuereth" % "xsbt-gpg-plugin" % "0.6" )

What is even worse, the problem persists, even after I removed ~/.sbt/plugins/build.sbt. So there are no more references (at least visible to me) to either sbt-idea or xsbt-gpg-plugin. Still I cannot compile any project any more, because sbt still tries to find those two plugins. Epic fail.

4 Answers

You can also specify sbtVersion and scalaVersion. There is an overloaded addSbtPlugin -

addSbtPlugin(dependency : sbt.ModuleID, sbtVersion : scala.Predef.String, scalaVersion : scala.Predef.String)
Related