我在发布/使用来自 bintray 的自定义 sbt 插件时遇到了一些麻烦。我可以sbt-plugin
在 bintray 上发布,但是当我尝试使用它时,解析器会使用另一条路径。
我已按照官方指南进行了调整,但已将其调整为最新版本的插件,我将其build.sbt
放入我的插件中:
lazy val commons = Seq(
organization in ThisBuild := "me.my.app",
version in ThisBuild := "0.1.0"
)
lazy val root = (project in file(".")).
settings(commons ++ BintrayPlugin.bintrayPublishSettings: _*).
settings(
sbtPlugin := true,
name := "sbt-plugin",
description := "Share configuration and plugins accros app projects",
bintrayOmitLicense := true,
publishMavenStyle := false,
bintrayRepository := "sbt-plugins",
bintrayOrganization := None
).
settings(
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0"),
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0"),
addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "0.8.0")
)
sbt-plugin> publish
任务成功完成并将我的插件发布
到me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
然后我添加并addSbtPlugin("me.my.app" % "sbt-plugin" % "0.1.0")
重新my-project\project\plugins.sbt
加载它。但他失败了
[warn] ==== bintray-{organization}-{repo}: tried
[warn] https://dl.bintray.com/{organization}/sbt-plugins/me/my/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pom
...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: me.my.app#sbt-plugin;0.1.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] me.my.app:sbt-plugin:0.1.0 (scalaVersion=2.10, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] me.my.app:sbt-plugin:0.1.0 (scalaVersion=2.10, sbtVersion=0.13) (/home/me/Projects/app/app-web/project/plugins.sbt#L7-8)
[warn] +- default:app-web-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: me.my.app#sbt-plugin;0.1.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
[error] (*:update) sbt.ResolveException: unresolved dependency: me.my.app#sbt-plugin;0.1.0: not found
如您所见,用于下载插件的 URL 与发布插件的 URL 不同。(与publishLocal
我的插件在同一路径下发布但成功解决。
- 当地的 :
me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
- 上传:
me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
- 下载:
me/my/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pom
我试过有或没有publishMavenStyle := false
,有Resolver.bintrayRepo
但Resolver.bintrayIvyRepo
没有成功。
我会遗漏一些东西,但我不得不承认我感到有点失落。那么应该对齐上传和下载路径的缺失配置是什么?
细节 :
publishMavenStyle := false
-> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jarpublishMavenStyle := true
-> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jarResolver.bintrayRepo
->我/我的/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pomResolver.bintrayIvyRepo
-> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/ivys/ivy.xml