Search code examples
sbtmaven-2maven-3nexus3

How to configure sbt to publish to private nexus maven repo?


[error] (*:publish) java.io.IOException: PUT operation to URL http://corporate.nexus:8081/repository/snapshots/service/local/staging/deploy/1.0/foo-1.0.pom failed with status code 503: Service Unavailable [error] Total time: 23 s, completed Jun 9, 2017 12:09:15 PM

I am getting this error when trying to use sbt publish to publish my jar to my nexus repository 3.13 maven repo.

I have the following configurations in the build.sbt

publishTo := { 
 val nexus = "http://corporate.nexus:8081/repository/snapshots/"
  if (isSnapshot.value)
   Some("snapshots" at nexus + "content/repositories/snapshots") 
  else
   Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

credentials += Credentials("Nexus Repository Manager", "corporate.nexus:8081/", "admin", "admin123")

publishMavenStyle := true

I am able to push the jar using maven 2 [ mvn deploy:deploy-file ]. but not mvn 3.


Solution

  • The realm name for the Nexus has to be exactly "Sonatype Nexus Repository Manager" case-sensitive. Not sure where to find the exact name for the Nexus and if it differs from version to version. This is for Nexus 3.