sbt无法从本地存储库解析插件

时间:2013-03-14 08:03:05

标签: scala sbt

我确实拥有自己的插件,我使用'publish-local'进行本地化。可以使用以前版本的sbt在其他项目中解析该插件,但它不再起作用。

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")

这是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

这是我想使用插件的plugin.sbt:

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")

最后我得到的错误消息

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

有谁知道为什么这不起作用?

2 个答案:

答案 0 :(得分:4)

据我所知,用于构建插件的Scala版本必须与用于构建sbt本身的Scala版本相匹配。 Sbt 0.12使用Scala 2.9构建,sbt 0.13使用Scala 2.10构建。

您的插件项目使用Scala 2.10构建插件。您的客户端项目可能也使用Scala 2.10,但您使用sbt 0.12来构建它。 Sbt因此试图找到你的Scala 2.9的插件,因为你发布了它的2.10失败了。

答案 1 :(得分:2)

由于项目的Scala版本在发布时与插件不匹配,您可能希望在addSbtPlugin中使用其他版本的build.sbt

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

第二个参数是sbtVersion,而最后一个参数是scalaVersion

请注意,一般情况下,与版本不匹配的插件可能会破坏其他不受支持的sbt和Scala版本。