scala – sbt:发布到企业Nexus存储库未经授权
快速分辨率
所需的凭证期望由nexus定义的确切领域。见下文如何找到您定义的那个,但绝对是“Sonatype Nexus Repository Manager”。将其他详细信息添加到正常的凭据中。 C:/data/user/.sbt/.credentials realm=Sonatype Nexus Repository Manager host=nexus user=repouser password=password build.sbt publishTo <<= version { v: String => val nexus = "http://nexus/" if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/libs-snapshots") else Some("releases" at nexus + "content/repositories/libs-releases") } 问题 我试图将一个罐子发布到一个公司的关系回购中。 我可以从Maven这样做,我已经配置了这些存储库,以便能够使用Nexus来提供内部的jar。但是,由于授权,发布失败。 > publish [info] Packaging c:apptargetscala-2.10app_2.10-0.1-sources.jar ... [info] Wrote D:apptargetscala-2.10app_2.10-0.1.pom [info] :: delivering :: com.app#app_2.10;0.1 :: 0.1 :: release :: Tue May 07 18:28:44 BST 2013 [info] Done packaging. [info] delivering ivy file to D:apptargetscala-2.10ivy-0.1.xml [info] Packaging D:apptargetscala-2.10app_2.10-0.1.jar ... [info] Done packaging. [trace] Stack trace suppressed: run last *:publish for the full output. [error] (*:publish) java.io.IOException: Access to URL http://nexus/content/groups/common/com/app/app_2.10/0.1/app_2.10-0.1.pom was refused by the server: Unauthorized C:/data/user/.sbt/.credentials realm=X host=nexus user=repouser password=password C:/data/user/.sbt/repositories [repositories] local x-repo: http://nexus/content/groups/common typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/,[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] sbt-plugin-releases: http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/ maven-central 应用程序/ build.sbt name := "app" organization := "com.app" version := "0.1" scalaVersion := "2.10.1" libraryDependencies ++= Seq( "org.scalatest" % "scalatest_2.10" % "2.0.M5b" % "test" ) EclipseKeys.withSource := true publishMavenStyle := true credentials += Credentials(Path.userHome / ".sbt" / ".credentials") publishTo := Some("X Maven Repo" at "http://nexus/content/groups/common") 我的Maven settings.xml <mirrors> <mirror> <id>x-repo</id> <name>X Maven repo</name> <url>http://nexus/content/groups/common</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors> <servers> <server> <id>x-repo</id> <username>repouser</username> <password>password</password> </server> </servers> 我已经遵循了official doc和各种其他职位的指示,包括这样的one的StackOverflow或this的邮件列表。没有工作。我尝试启用额外的日志记录,但没有进一步的细节。 我可以使用以下命令手动部署到maven: mvn deploy:deploy-file -Durl=http://nexus/content/repositories/libs-snapshots -DrepositoryId=x-repo -DgroupId=com.app -DartifactId=app -Dpackaging=jar -Dversion=0.1-SNAPSHOT -Dfile=D:apptargetscala-2.10app_2.10-0.1.jar 尝试使用以下publishTo,也没有运气 publishTo <<= version { v: String => val nexus = "http://nexus/" if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/libs-snapshots") else Some("releases" at nexus + "content/repositories/libs-releases") } 这些命令运行正常,直到它们需要被授权,此时它们失败。 凭证中的领域是否对应于maven中的Server Repository ID或Name?要么或者不起作用 我一直试图为常春藤启用更多的日志记录,但无法获得更多的细节。 set ivyLoggingLevel:= UpdateLogging.Full 据此,应进一步记录: https://svn.apache.org/repos/asf/ant/ivy/core/tags/2.2.0/src/java/org/apache/ivy/util/url/IvyAuthenticator.java 我在内部代理后面,所以我需要设置HTTP用户和HTTPS用户和密码。也许在这里,它被阻止了? 有什么建议如何提高常春藤伐木的水平? 更新 我有一些工作,通过使用sbt-aether-deploy插件,它使用Maven基础架构(货车)部署。 证书完全一样。其实这个领域似乎并不重要。 以下是使用的行: credentials += Credentials(Path.userHome / ".sbt" / ".credentials") publishTo <<= version { v: String => val nexus = "http://nexus/" if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/libs-snapshots") else Some("releases" at nexus + "content/repositories/libs-releases") } seq(aetherSettings: _*) seq(aetherPublishSettings: _*) 代理,常春藤和联系之间的东西不对。 我仍然对使用常春藤的建议感兴趣。 进一步更新: 运用 curl -X POST http://nexusUser:nexusPassword@nexus/content/repositories/libs-snapshots -v 我能够到达服务器。 相同的结果指定要使用的代理(它被配置为绕过本地网络,但是一些java进程,如SBT似乎需要标头) 当nexusUser:nexusPassword没有具体化时,我得到以下标题: WWW认证:BASIC realm =“Sonatype Nexus Repository Manager” 有效的是这个问题,凭证需要将领域的名称作为这个确切的头,而不是像maven这样的其他自定义存储库名称。 非常感谢! 解决方法
Ivy使用WWW-Authenticate标头的领域,这将不得不将与字节字节相等于您的凭据文件中配置的字节。
sbt-aether-deploy使用相同的头,但使用Aether作为其部署机制。常春藤没有。 弄清WWW-Authenticate标头的价值的最简单方法是使用cURL。 curl -X POST http://nexus/content/repositories/libs-snapshots -v > /dev/null cURL将提示您输入用户并通过。 -v将添加详细信息,以便您可以看到请求和响应的头文件。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Scala和Google的’Go’语言之间是否有比较(按功能分类)?
- angularjs – 量角器 – 获取“Runtime.executionContextCr
- webservice安全之WS-Security验证
- 如何访问在父组件上定义的ViewChild引用 – Angular 2
- Angular 2 – 从angular 2发送到web api时加密密码
- scala – Specs2“value in不是String的成员”
- 对于泛型类型和它的类型参数的Scala类型推断 – 为什么它不
- angular之provide,service,factory等区别
- [yum]Another app is currently holding the yum lock
- 【Angular】——无限级下拉列表框