我正在尝试将SBT插件发布到存储库.我不确定这是否有任何相关性,但我们的插件加载了sbt-twirl插件 - 谷歌搜索,看起来像publishConfiguration可能被覆盖:
new PublishConfiguration(None, "dotM2", arts, Seq(), level)
Run Code Online (Sandbox Code Playgroud)
当我运行发布任务时,工件被部署到repo,但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.
Run Code Online (Sandbox Code Playgroud)
导致错误的原因是什么,以及如何阻止发布失败?
**更新**这是 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
Run Code Online (Sandbox Code Playgroud)
这是我如何配置发布(使用一些插件设置,不包括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")
)
Run Code Online (Sandbox Code Playgroud)
tl;dr不要用来lazy val plugin = project定义项目(出于未知的原因)
经过一些评论后发现问题在于plugin使用lazy val plugin = project. 看来这个名字是有保留的。将项目名称更改为plugin“并重新开始”以外的任何其他名称。
| 归档时间: |
|
| 查看次数: |
4509 次 |
| 最近记录: |