gpt4 book ai didi

sbt - 为什么发布插件项目失败并出现 RuntimeException : Repository for publishing is not specified?

转载 作者:行者123 更新时间:2023-12-04 12:07:30 25 4
gpt4 key购买 nike

我正在尝试将 SBT 插件发布到存储库。我不确定这是否有任何相关性,但我们的插件加载了 sbt-twirl插件 - 谷歌搜索,似乎publishConfiguration 可能会被覆盖:

new PublishConfiguration(None, "dotM2", arts, Seq(), level)

当我运行发布任务时,工件被部署到存储库,但 sbt 任务失败了:
sbt (my-sbt-plugin)> publish
[info] Loading global plugins from ...
...
[info] Done packaging.
[info] published sbt-my-sbt-plugin to http://my.repo.com/.../sbt-my-sbt-plugin-0.1-SNAPSHOT.jar
java.lang.RuntimeException: Repository for publishing is not specified.
.... stack trace here ....
[error] (my-sbt-plugin/*:publishConfiguration) Repository for publishing is not specified.

是什么导致了错误,我该怎么做才能阻止发布失败?

** 更新 ** 这里是 inspect publish
sbt (my-sbt-plugin)> inspect publish                                                                                                                   
[info] Task: Unit
[info] Description:
[info] Publishes artifacts to a repository.
[info] Provided by:
[info] {file:/path/to/my-sbt-plugin/}my-sbt-plugin/*:publish
[info] Defined at:
[info] (sbt.Classpaths) Defaults.scala:988
[info] Dependencies:
[info] my-sbt-plugin/*:ivyModule
[info] my-sbt-plugin/*:publishConfiguration
[info] my-sbt-plugin/*:publish::streams
[info] Delegates:
[info] my-sbt-plugin/*:publish
[info] {.}/*:publish
[info] */*:publish
[info] Related:
[info] plugin/*:publish

这是我配置发布的方式(使用一些插件设置,不包括 libraryDependencies 和 1 或 2 个其他设置)
lazy val plugin = project
.settings(publishSbtPlugin: _*)
.settings(
name := "my-sbt-plugin",
sbtPlugin := true,
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.0.2")
)

def publishSbtPlugin = Seq(
publishMavenStyle := true,
publishTo := {
val myrepo = "http://myrepo.tld/"
if (isSnapshot.value) Some("The Realm" at myrepo + "snapshots")
else Some("The Realm" at myrepo + "releases")
},
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
)

最佳答案

tl;博士 不要使用 lazy val plugin = project定义一个项目(未知原因)

经过几次评论后发现问题在于项目名称 plugin使用 lazy val plugin = project 定义.似乎这个名字以某种方式保留了下来。将项目名称更改为除 plugin 之外的任何其他名称并重新开始。

关于sbt - 为什么发布插件项目失败并出现 RuntimeException : Repository for publishing is not specified?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26296493/

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