wwagner4
wwagner4

Reputation: 154

sbt cannot resolve plugin from local repository

I do have my own plugin that I pulish local with 'publish-local'. Could resolve that plugin in other projects using previous versions of sbt, but it does not work any longer.

build.sbt of the plugin
sbtPlugin       := true

name            := "sumosim-webstart"

organization    := "net.entelijan"

version         := "1.3"

scalaVersion    := "2.10.0"

crossPaths      := false

publishTo       := Some("entelijan-repo" at "http://entelijan.net/artifactory/repositories/libs-ivy-local/")

credentials += Credentials("Artifactory Realm", "entelijan.net", "xxxx", "xxxx")

//scalacOptions ++= Seq("-deprecation", "-unchecked")

That is the output produced by sbt publish-local

 [exec] [info] Packaging /home/wolfi/prj/sumosim/sumosim-pom/sumosim-webstart/target/sbt-0.12/sumosim-webstart-1.3-javadoc.jar ...
 [exec] [info] Done packaging.
 [exec] [info]  published sumosim-webstart to /home/wolfi/.ivy2/local/net.entelijan/sumosim-webstart/scala_2.10/sbt_0.12/1.3/poms/sumosim-webstart.pom
 [exec] [info]  published sumosim-webstart to /home/wolfi/.ivy2/local/net.entelijan/sumosim-webstart/scala_2.10/sbt_0.12/1.3/jars/sumosim-webstart.jar
 [exec] [info]  published sumosim-webstart to /home/wolfi/.ivy2/local/net.entelijan/sumosim-webstart/scala_2.10/sbt_0.12/1.3/srcs/sumosim-webstart-sources.jar
 [exec] [info]  published sumosim-webstart to /home/wolfi/.ivy2/local/net.entelijan/sumosim-webstart/scala_2.10/sbt_0.12/1.3/docs/sumosim-webstart-javadoc.jar
 [exec] [info]  published ivy to /home/wolfi/.ivy2/local/net.entelijan/sumosim-webstart/scala_2.10/sbt_0.12/1.3/ivys/ivy.xml

That is the plugin.sbt where I want to use the plugin:

resolvers ++= Seq(
    "typesave" at "http://repo.typesafe.com/typesafe/releases",
    "sbt-idea-repo" at "http://mpeltonen.github.com/maven/",
    "entelijan" at "http://entelijan.net/artifactory/repo/"
)

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")

addSbtPlugin("net.entelijan" % "sumosim-webstart" % "1.3")

And finally the errormessage I get

[exec] [error] (*:update) sbt.ResolveException: unresolved dependency: net.entelijan#sumosim-webstart;1.3: not found

Does anyone know why this does not work?

Upvotes: 3

Views: 4186

Answers (2)

Jacek Laskowski
Jacek Laskowski

Reputation: 74669

Since the project's Scala version doesn't match the plugin when it was published, you might want to use another version of addSbtPlugin in build.sbt:

addSbtPlugin("net.entelijan" % "sumosim-webstart" % "1.3", "0.12‌​", "2.10")

The second parameter is sbtVersion while the last is for scalaVersion.

Be warned that in general a plugin that doesn't match the versions as a published artefact might break with other unsupported versions of sbt and Scala.

Upvotes: 2

Malte Schwerhoff
Malte Schwerhoff

Reputation: 12852

As far as I know, the Scala version that is used to build the plugin has to match the Scala version that was used to build sbt itself. Sbt 0.12 is build with Scala 2.9, sbt 0.13 with Scala 2.10.

Your plugin project uses Scala 2.10 to build the plugin. Your client project probably also uses Scala 2.10, but you use sbt 0.12 to build it. Sbt thus tries to find your plugin for Scala 2.9, which fails, since you published it for 2.10.

Upvotes: 4

Related Questions