我试图将sbt-publish
生成的胖jar推送到私有Nexus存储库。所以,在我的Nexus中,我创建了两个存储库,一个托管快照版本和一个托管版本工件。
以下是我build.sbt
中的重要代码:
publishTo := {
val nexus = "http://localhost:8081/"
if (isSnapshot.value)
Some("snapshots" at nexus + "repository/test-snapshots")
else
Some("releases" at nexus + "repository/test-releases")
}
credentials += Credentials(
"Sonatype Nexus Repository Manager", "localhost", "admin", "admin123"
)
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
这是堆栈跟踪的一部分:
[info] Assembly up to date: /.../target/scala-2.11/test-assembly-1.0-SNAPSHOT.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT-javadoc.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT-sources.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT.jar
[info] published test_2.11 to http://localhost:8081/repository/test-snapshots/com/test/test_2.11/1.0-SNAPSHOT/test_2.11-1.0-SNAPSHOT.pom
[error] java.net.SocketException: Broken pipe (Write failed)
因此,正如我们所看到的,它能够将工件发布到pom文件。
提前感谢您的帮助!