我正在尝试发布 library通过 sonatype 到 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")
发生错误:
tried [warn] 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 插件已发布,路径中包含 sbt 版本
关于java - sbt 版本从 Maven Central 中的文件夹结构生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49486163/