Error message:
java.io.IOException: Access to URL
http://maven.company.com/repository/internal/com/company/
project_2.10/0.0.3/project_2.10-0.0.3.pom was
refused by the server: Unauthorized
Running Apache Archiva 1.4-M4(latest), I am able to upload via the web interface, but not via SBT.
Using these settings in SBT:
publishTo := Some("company releases" at "http://maven.company.com/repository/internal"),
credentials += Credentials(
"company Maven Repository",
"maven.company.com",
"username",
"password"
),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => true },
// .. some xml with author details
}
All details, including username, password and urls are correct.
The Security Realm is important to Ivy. It's like the only dependency manager that requires you to use a valid Security realm. I believe for apache archiva it's "Repository Archiva Managed". You can check by trying to do your own HTTP request to Archiva and see what Realms it tells you it supports.
Here's code which attempts to detect security realms: https://github.com/sbt/sbt-pom-reader/blob/2b515b58739ef7bdfad8f98248e901db8e140892/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala#L212-L221
Update: The realm looks like: "Repository Archiva Managed internal Repository". If you publish to other repos, replace "internal" with the name of the repo.
once you determine the security realm, you want to update your build as follows:
credentials += Credentials(
"Repository Archiva Managed internal Repository", // Or whatever you detect as the security realm
"maven.company.com",
"username",
"password"
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With