4

I'm trying to push a fat jar generated by sbt-publish to a private Nexus repository. So, in my Nexus, I've created two repositories, one hosting snapshots version and one hosting releases artifacts.

Here is the important code in my 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)

Here's a part of the stacktrace:

[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)

So, as we can see, it is able to publish the artifacts until the pom file.

Thank you in advance for your help !

Mael Razavet
  • 202
  • 2
  • 11
  • 1
    I was able to publish using the code you pasted. Probably you're dealing with network/connection issues. – minyo Oct 11 '18 at 03:32

0 Answers0