gpt4 book ai didi

sbt:将插件发布到本地仓库并从本地仓库解析

转载 作者:行者123 更新时间:2023-12-02 01:03:05 24 4
gpt4 key购买 nike

我正在尝试将 sbt 插件发布到本地文件存储库。在插件的 build.sbt 我有:

publishTo := Some(Resolver.file("localtrix", file("/Users/jast/repo/localtrix")))

我运行 publish任务,它可以很好地发布到 /Users/jast/repo/localtrix/org/me/sbt-plugin_2.12_1.0/1.2.3
在另一个项目中,我想解决这个插件。在 project/plugins.sbt我有:
resolvers += Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))
addSbtPlugin("org.me" % "sbt-plugin" % "1.2.3")

我尝试在这个项目中运行 sbt,我得到:
[info] Updating ProjectRef(uri("file:/Users/jast/playspace/untitled38/project/"), "untitled38-build")...
[warn] module not found: org.me#sbt-plugin;1.2.3
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml/2017.2+4-3037ba82+20180314-1919/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/jast/.ivy2/local/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/me/sbt-plugin_2.12_1.0/1.2.3/sbt-plugin-1.2.3.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/jast/.sbt/preloaded/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/jast/.sbt/preloaded/org/me/sbt-plugin_2.12_1.0/1.2.3/sbt-plugin-1.2.3.pom
[warn] ==== localtrix: tried
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.me#sbt-plugin;1.2.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

那么我怎样才能以一种也能正确解析的方式将它发布到本地存储库呢?

注: publishLocal并从 .ivy2/local 解析工作,但我希望能够发布到一个我可以复制到另一台机器而不会弄乱该目录的存储库。

最佳答案

sbt 插件默认是 Ivy 风格的,所以当你引用你的本地存储库时,使用 Resolver.ivyStylePatterns .发布:

publishTo := Some(Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))(Resolver.ivyStylePatterns))

并解决:
resolvers += Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))(Resolver.ivyStylePatterns)
addSbtPlugin("org.me" % "sbt-plugin" % "1.2.3")

或者,您可以设置 publishMavenStyle := true插件,但我看到你已经想通了。

关于sbt:将插件发布到本地仓库并从本地仓库解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49285413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com