错误信息:
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
运行Apache Archiva 1.4-M4(最新版),我可以通过网络界面上传,但不能通过SBT上传.
在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 }
解决方法
安全领域对常春藤很重要.它就像是唯一要求您使用有效安全领域的依赖管理器.我相信apache archiva是“Repository Archiva Managed”.您可以通过尝试向Archiva发出自己的HTTP请求进行检查,并查看它支持的Realms.
这是试图检测安全领域的代码:https://github.com/sbt/sbt-pom-reader/blob/2b515b58739ef7bdfad8f98248e901db8e140892/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala#L212-L221
更新:
领域看起来像:“Repository Archiva Managed internal Repository”.如果您发布到其他repos,请将“internal”替换为repo的名称.
确定安全领域后,您需要按如下方式更新构建:
credentials += Credentials( "Repository Archiva Managed internal Repository",// Or whatever you detect as the security realm "maven.company.com","password" ),