Play 框架和 sbt:将凭据传递到 Nexus 密码保护的存储库

2024-02-15

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

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

用户: testmx

通过:testmx@testmx

组ID:testmx

工件 ID:testmxcommons

版本:1.0.0-SNAPSHOT

所以我定义了以下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/"
    )

}

我收到以下错误:

[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

我尝试了几种替代方法,但它们给了我同样的错误......

我查过本文 http://code.google.com/p/simple-build-tool/wiki/Publishing和这个所以问题 https://stackoverflow.com/questions/4342079/how-can-i-retrieve-snapshot-dependencies-from-nexus-using-sbt

还尝试将用户和密码保存在外部文件中,正如所解释的那样here https://github.com/harrah/xsbt/wiki/Publishing and here https://cloudbees.zendesk.com/entries/20836643-sbt-publish-to-repositories.

任何想法?

-- 编辑以澄清 --

我更改了真实的 url,因为它不是我正在使用的公共存储库...真实的 url 在那里,并且 sbt 试图找到的 pom 确实存在...

PS:顺便说一句.. sbt scaladocs 在哪里???


您需要告诉 SBT 您想要发布到哪个存储库:

publishTo := Some("testmx public" at "http://deploy.cloud.testmx.com:8081/nexus")

此外,如果您不想将凭据保留在构建文件中,您可以通过添加以下行来告诉它在本地检索它们:

credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),

而在你的~/.ivy2目录创建一个.credentials像这样的文件:

realm=Sonatype Nexus Repository Manager
host=deploy.cloud.testmx.com
user=testmx
password=testmx@testmx

See https://github.com/harrah/xsbt/wiki/Publishing https://github.com/harrah/xsbt/wiki/Publishing了解更多

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Play 框架和 sbt:将凭据传递到 Nexus 密码保护的存储库 的相关文章

随机推荐