当我运行sbt publishLocal
时,插件将在<ivy-repository>/<org>/<plugin>/<scala-version>/<sbt-version>/<plugin-version>/...
例如:
[info] published sbt-cloudengine to /Users/hanxue/.ivy2/local/net.entrypass/sbt-cloudengine/scala_2.10/sbt_0.13/0.2.1/jars/sbt-cloudengine.jar
如何从输出路径中排除<scala-version>
和<sbt-version>
?
当我在build.sbt
:
[warn] ==== Local Ivy Repository: tried
[warn] file:///Users/hanxue/.ivy2/local/net/entrypass/sbt-cloudengine/0.2.1/sbt-cloudengine-0.2.1.pom
插件的build.sbt
是:
sbtPlugin := true
name := "sbt-cloudengine"
organization := "net.entrypass"
version := "0.2.1"
description := "sbt plugin for managing Google Cloud Engine resources"
licenses := Seq("BSD License" -> url("https://github.com/hanxue/sbt-cloudengine/blob/master/LICENSE"))
scalacOptions := Seq("-deprecation", "-unchecked")
publishArtifact in (Compile, packageBin) := true
publishArtifact in (Test, packageBin) := false
publishArtifact in (Compile, packageDoc) := false
publishArtifact in (Compile, packageSrc) := false
publishMavenStyle := false
这就是项目<rootdir>/build.sbt
resolvers += "Local Ivy Repository" at "file://"+Path.userHome.absolutePath+"/.ivy2/local"
libraryDependencies ++= Seq(
"net.entrypass" % "sbt-cloudengine" % "0.2.1"
)
这是目录列表
$ ls -R ~/.ivy2/local/net.entrypass/sbt-cloudengine/scala_2.10/sbt_0.13/0.2.1/
ivys jars poms
/Users/hanxue/.ivy2/local/net.entrypass/sbt-cloudengine/scala_2.10/sbt_0.13/0.2.1//ivys:
ivy.xml ivy.xml.md5 ivy.xml.sha1
/Users/hanxue/.ivy2/local/net.entrypass/sbt-cloudengine/scala_2.10/sbt_0.13/0.2.1//jars:
sbt-cloudengine.jar sbt-cloudengine.jar.sha1
sbt-cloudengine.jar.md5
/Users/hanxue/.ivy2/local/net.entrypass/sbt-cloudengine/scala_2.10/sbt_0.13/0.2.1//poms:
sbt-cloudengine.pom sbt-cloudengine.pom.sha1
sbt-cloudengine.pom.md5
答案 0 :(得分:2)
由于您要发布sbt插件而不是库,因此该路径将正确包含sbt版本和scala版本。
您的问题来自于您尝试使用libraryDependencies
加载插件的事实。相反,您必须使用文件project/plugins.sbt
,其中包含以下内容:
addSbtPlugin("net.entrypass" % "sbt-cloudengine" % "0.2.1")
这样,sbt将在当前scala和sbt版本的帮助下使用正确的路径搜索插件。