【发布时间】:2018-09-04 06:50:39
【问题描述】:
我正在尝试通过 sonatype 将 library 发布到 maven-central。
通过sbt +release发布时,我成功上传了jar。
但是文件夹结构错误:
https://repo1.maven.org/maven2/de/otto/jetty-ldap_2.10_0.13/0.1.1/
路径中有sbt版本(0.13)。
使用这种结构,我无法将 jar 用作依赖项。我这样使用它:
libraryDependencies ++= Seq(
"de.otto" %% "jetty-ldap" % "0.1.1")
发生错误:
试过了 [警告]https://repo1.maven.org/maven2/de/otto/jetty-ldap_2.11/0.1.1/jetty-ldap_2.11-0.1.1.pom
路径显然不匹配。 有人有什么想法吗?我有点迷路了..
我的 build.sbt 缩短了:
lazy val root = (project in file(".")).
settings(
name := "jetty-ldap",
organization := "de.otto",
licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://dev.otto.de/")),
sbtPlugin := true
)
scalaVersion in ThisBuild := "2.12.5"
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
crossSbtVersions := Vector("0.13.17", "1.1.0")
// From: https://github.com/xerial/sbt-sonatype#using-with-sbt-release-plugin
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
releaseCrossBuild := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
releaseStepCommandAndRemaining("^ test"),
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("^ publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
)
evgeny的解决方案
为了解决这个问题,我们不得不删除 sbtPlugin := true 行,因为这会导致文件夹结构中出现 sbt 版本。
【问题讨论】:
-
sbtPlugin := true你发布了 sbt 插件,对吧? Sbt 插件在 apth 中使用 sbt 版本发布。 -
是的。谢谢你。我完全忽略了这一点。 :)
-
@Evgeny 我刚刚意识到这个问题仍然“没有答案”。您能否发表您的评论作为答案,因为它是正确的解决方法? :)
-
Jiust 做到了。谢谢