无法使用 sbt 0.13 上传到 sonatype 且 xsbt-gpg-plugin 未解决依赖项:com.jsuereth#xsbt-gpg-plugin;0.6
Posted
技术标签:
【中文标题】无法使用 sbt 0.13 上传到 sonatype 且 xsbt-gpg-plugin 未解决依赖项:com.jsuereth#xsbt-gpg-plugin;0.6【英文标题】:Fail to upload to sonatype with sbt 0.13 with xsbt-gpg-plugin unresolved dependency: com.jsuereth#xsbt-gpg-plugin;0.6 【发布时间】:2014-12-17 21:05:32 【问题描述】:我的plugins.sbt
有这个:
logLevel := Level.Warn
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "1.0.0")
resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases")) (Resolver.ivyStylePatterns)
addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")
当我运行sbt publish
时,我得到:
[警告] ==== sbt-plugin-releases: 试过 [警告]http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/com.jsuereth/xsbt-gpg-plugin/scala_2.10/sbt_0.13/0.6/ivys/ivy.xml [警告] :::::::::::::::::::::::::::::::::::::::::::::: [警告] :: 未解决的依赖::[警告] :::::::::::::::::::::::::::::::::::::::::::::: [警告]: : com.jsuereth#xsbt-gpg-plugin;0.6: 未找到 [警告] :::::::::::::::::::::::::::::::::::::::::::::: [警告] [警告] 注意: 一些未解决的依赖项具有额外的属性。检查这些 依赖项与请求的属性存在。 [警告] com.jsuereth:xsbt-gpg-plugin:0.6 (sbtVersion=0.13, scalaVersion=2.10) [警告] sbt.ResolveException: unresolved 依赖项:com.jsuereth#xsbt-gpg-plugin;0.6:未找到 sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217) 在 sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
所以我尝试将addSbtPlugin
更新为:
addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6",
sbtVersion = "0.12", // SBT version
scalaVersion = "2.9.2" )
现在我明白了
[warn] The global sbt directory is now versioned and is located at /home//.sbt/0.13.
[warn] You are seeing this warning because there is global configuration in /home//.sbt but not in /home//.sbt/0.13.
[warn] The global sbt directory may be changed via the sbt.global.base system property.
[info] Loading project definition from /home//dev/projects/myproj/project
[warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).
**java.lang.NoClassDefFoundError: sbt/Scoped$ListSetting**
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
无论如何,请修复它? 谢谢
【问题讨论】:
【参考方案1】:不确定,但我认为您使用的是该插件的相当旧版本?
我将以下内容与最新的 sbt 0.13.6 一起使用。我在~/.sbt/0.13/plugins/build.sbt
中全局安装了这个:
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") // sign Sonatype artifacts
我还在~/.sbt/0.13/sonatype.sbt
中留下了我的凭据:
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"user-name", "pass-word")
这样我可以做到sbt publish-signed
。
Here is the plugin documentation。 (如您所见,已经有更新的版本可用)
【讨论】:
以上是关于无法使用 sbt 0.13 上传到 sonatype 且 xsbt-gpg-plugin 未解决依赖项:com.jsuereth#xsbt-gpg-plugin;0.6的主要内容,如果未能解决你的问题,请参考以下文章
未解决的依赖:org.scala-sbt#sbt; 0.13:运行sbt 0.13时找不到?
在 sbt 0.13 中使用 .sbt 文件编写多项目构建的惯用方式