I am using sbt-native-packager to build an rpm that we then store into a maven2 hosted repo via Nexus. This worked great in Nexus 2, but once we moved to Nexus 3, it no longer accepted the rpm into the repo. It accepts the jar, sources-jar, sources-javadoc, and pom fine, but when it comes to the rpm it gives a 502 Bad Gateway error (which I believe means it does not conform to the maven type?)
java.io.IOException: PUT operation to URL http://nexus.snip.com/repository/releases/com/snip/email-dispatcher-consumer/1.0.17/email-dispatcher-consumer-1.0.17.rpm failed with status code 502: Bad Gateway
Two questions:
1) Is there a way to tell the publishTo in Rpm to publishTo a different nexus endpoint? Perhaps a raw hosted repo? I tried the following:
publishTo in Rpm := {
val nexus = "http://nexus.snip.com/"
Some("releases" at nexus + "repository/rpm-build-storage")
}
But this did not have the desired effect.
2) Is there a way to push the rpm into the existing repo like we did in Nexus 2?
We use sbt-release with this and I added the following release step to the release process, and this worked fine with Nexus 2
val publishRPM = ReleaseStep(action = st => {
val extr: Extracted = Project.extract(st)
val ref: ProjectRef = extr.get(thisProjectRef)
extr.runAggregated(
publish in Rpm in ref,
st
)
st
})
Is there a way to tell the publishTo in Rpm to publishTo a different nexus endpoint? Perhaps a raw hosted repo?
Yes, there is. I had to tinker around with sbt a bit myself. You almost got it right, but sbt/ivy uses unique string names to find resolvers, so you have to add them in the right scope. It would be awesome if you could open an issue on sbt-native-packager to add this in the Deployment
plugins.
// NOT NECESSARY. This resolver is automagically added to the `otherResolvers` setting.
publishTo := Some(Resolver.file("file-target", target.value / "ivy2" ))
// add your resolver to the `otherResolvers` setting and rpm:publish will find it
otherResolvers += Resolver.file("file-rpm", target.value / "ivy2-rpm")
publishTo in Rpm := Some(Resolver.file("file-rpm", target.value / "ivy2-rpm"))
Is there a way to push the rpm into the existing repo like we did in Nexus 2?
That I don't know :(
hope the first answer helps you :)
cheers and a happy new year, Muki