【问题标题】:Can't resolve to plugin published in Bintray无法解析在 Bintray 中发布的插件
【发布时间】:2015-06-06 21:54:09
【问题描述】:

我按照sbt manual 中描述的说明使用bintray-sbt 插件将sbt 插件发布到Bintray。它已发布正常,但我在解决它时遇到了问题。

我有这个在~/.sbt/0.13/plugins/plugins.sbt:

resolvers += Resolver.bintrayRepo("alpeb", "sbt-plugins")

addSbtPlugin("com.alpeb" % "sbt-gitignore" % "1.0.1")

当我为任何给定项目启动 sbt 时,它会尝试将插件解析为类似 https://dl.bintray.com/alpeb/sbt-plugins/com/alpeb/sbt-gitignore_2.10_0.13/1.0.1/sbt-gitignore-1.0.1.pom

但 Bintray 将我的文件放在 https://dl.bintray.com/alpeb/sbt-plugins/com.alpeb/sbt-gitignore/scala_2.10/sbt_0.13/ 那里似乎没有 poms,只有 xml 和 jars。

【问题讨论】:

    标签: sbt


    【解决方案1】:

    好像有问题

    resolvers += Resolver.bintrayRepo("alpeb", "sbt-plugins")
    

    改用这个就可以了:

    resolvers += Resolver.url(
      "bintray-alpeb-sbt-plugins",
      url("http://dl.bintray.com/alpeb/sbt-plugins"))(
      Resolver.ivyStylePatterns)
    

    【讨论】:

    • 您的插件是使用 ivy 模式发布的,但 Resolver.bintrayRepo() 是 maven repo 模式的快捷方式(这是默认设置)。不知道为什么你的插件是这样发布的......
    • @JBaruch 在 sbt 最佳实践中推荐使用 ivy 样式模式发布:scala-sbt.org/0.13/docs/Bintray-For-Plugins.html
    • resolvers += Resolver.bintrayIvyRepo("alpeb", "sbt-plugins") 也可以。
    【解决方案2】:

    sbt 的Bintray-For-Plugins 手册还告诉将您的插件链接到 sbt 的共享存储库,这可能会起到作用。但我用Resolver.bintrayIvyRepo 解决了同样的问题,这与@AlejandroPedraza 建议的基本相同:

    resolvers += Resolver.bintrayIvyRepo("alpeb", "sbt-plugins")

    【讨论】:

      猜你喜欢
      • 2017-03-01
      • 2019-03-01
      • 2022-06-29
      • 2017-05-06
      • 2016-04-04
      • 2017-08-19
      • 2015-08-03
      • 2015-11-18
      • 2014-12-18
      相关资源
      最近更新 更多