播放框架和sbt:传递凭据到nexus passowrd protected repo [英] Play framework and sbt: passing credentials to a nexus passowrd protected repo

查看:167
本文介绍了播放框架和sbt:传递凭据到nexus passowrd protected repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将以下库定义为依赖:



url: http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/



user:testmx



pass:testmx @ testmx



groupId:testmx



artifactId:testmxcommons



版本:1.0.0-SNAPSHOT



所以我定义了以下项目/ Build.scala

  import sbt._ 
import Keys._
import PlayProject._

对象ApplicationBuild extends Build {

val appName =testmxproject
val appVersion =1.0-SNAPSHOT

val appDependencies = Seq(
mysql%mysql-connector-java%5.1.18,
testmx%testmxcommons%1.0.0-SNAPSHOT


val main = PlayProject(appName,appVersion,appDependencies,mainLang = SCALA).settings (
credentials + =(testmx public,deploy.cloud.testmx.com:8081,testmx,testmx @ testmx),
resolvers + =testmx public http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/


}

我收到以下错误:

  [warn]没有找到模块:testmx#testmxcommons; 1.0.0-SNAPSHOT 

[warn] ==== testmx public:试过
[警告] http://deploy.cloud.testmx.com :8081 / nexus / content / groups / public / testmx / textmxcommons / 1.0.0-SNAPSHOT / textmxcommons-1.0.0-SNAPSHOT.pom

我尝试了几种替代方案,但是他们给了我相同的错误...



我已经检查过这篇文章和这个 SO问题



还试图保存t他在外部文件上的用户和密码,如此处 here



any想法?



- 编辑澄清 -



我更改了真正的网址,因为它不是一个公共的回购我正在工作...真正的url在那里,sbt试图找到的pom存在...



ps:BTW ..哪里是sbt scaladocs ???

解决方案

传递凭证时有两个问题。



第一个是我错过了这个世界。 (感谢Alex Varju)



您必须通过服务器在尝试登录时发送给您的同一个领域(只需按ctrl-shift-I或F12对铬,并得到网络看看它)



第二个问题是我传递端口号,sbt似乎不喜欢...



所以,最后我这样做,它可以正常工作:

  val main = PlayProject(appName,appVersion,appDependencies,mainLang = SCALA).settings(
credentials + =(Sonatype Nexus Repository Manager,deploy.cloud.testmx.com testmx,testmx @ testmx),
resolvers + =testmx publicathttp://deploy.cloud.testmx.com:8081/nexus/content/groups/public/

按照预期,在不同的文件中设置凭据,同样的修改也可以正常工作。 ..



感谢所有的答案


I need to define as a dependency the following library:

url: http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/

user: testmx

pass: testmx@testmx

groupId: testmx

artifactId: testmxcommons

version: 1.0.0-SNAPSHOT

So I defined the following project/Build.scala

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "testmxproject"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      "mysql" % "mysql-connector-java" % "5.1.18",
      "testmx" % "testmxcommons" % "1.0.0-SNAPSHOT"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
      credentials += ("testmx public", "deploy.cloud.testmx.com:8081", "testmx", "testmx@testmx"),
      resolvers += "testmx public" at "http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/"
    )

}

and I get the following error:

[warn]  module not found: testmx#testmxcommons;1.0.0-SNAPSHOT

[warn] ==== testmx public: tried
[warn]   http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/testmx/textmxcommons/1.0.0-SNAPSHOT/textmxcommons-1.0.0-SNAPSHOT.pom

I tried several alternatives but they give me the same error...

I've checked this article and this SO question

And also tried saving the user and password on an external file, as it's explained here and here.

any idea?

-- edit to clarify --

I changed the real url because it's not a public repo I'm working with... The real url is there and the pom that sbt is trying to find does exist...

ps: BTW.. where are sbt scaladocs???

解决方案

There were two problems when passing the credentials.

The first was that I was passing the wrong Realm. (Thanks to Alex Varju for this one)

You have to pass the same Realm that the server is sending you when trying to log (Just press ctrl-shift-I or F12 on chromium and got to network to have a look at it)

The second problem is that I was passing the port number, and sbt doesn't seem to like that...

So, in the end I did it like this and it works ok:

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
  credentials += ("Sonatype Nexus Repository Manager", "deploy.cloud.testmx.com", "testmx", "testmx@testmx"),
  resolvers += "testmx public" at "http://deploy.cloud.testmx.com:8081/nexus/content/groups/public/"
)

Settings your credentials in a different file, as expected, worked ok too with the same modifications...

Thanks to all for your answers

这篇关于播放框架和sbt:传递凭据到nexus passowrd protected repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆