相关疑难解决方法(0)

如何使用sbt访问受保护的Nexus?

我正在尝试访问需要一些基本身份验证的Nexus存储库管理器.从Maven2开始,一切正常,但是当我尝试在SBT中配置时,它找不到工件.它使用的是自定义存储库模式(请参阅此相关问题),但我认为这不重要.在任何情况下,相关配置都在这里.

Project.scala:

val snapshotsName = "Repository Snapshots"
val snapshotsUrl = new java.net.URL("http://nexusHostIp:8081/nexus/content/repositories/snapshots")
val snapshotsPattern = "[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision](-[timestamp]).[ext]"
val snapshots = Resolver.url(snapshotsName, snapshotsUrl)(Patterns(snapshotsPattern))
Credentials(Path.userHome / ".ivy2" / ".credentials", log)

val dep = "group" % "artifact" % "0.0.1" extra("timestamp" -> "20101202.195418-3")
Run Code Online (Sandbox Code Playgroud)

〜/ .ivy2/.credentials:

realm=Snapshots Nexus
host=nexusHostIp:8081
user=nexususername
password=nexuspassword
Run Code Online (Sandbox Code Playgroud)

根据SBT用户组中的类似讨论,这应该可以正常工作,但是当我尝试构建时,我得到以下内容.

==== Repository Snapshots: tried
[warn]    -- artifact group#artifact;0.0.1!artifact.jar:
[warn]    http://nexusHostIp:8081/nexus/content/repositories/snapshots/group/artifact/0.0.1-SNAPSHOT/artifact-0.0.1-20101202.195418-3.jar
Run Code Online (Sandbox Code Playgroud)

我相当肯定这是一个凭证问题,而不是别的因为我可以点击它说它正在尝试的URL并下载jar(在验证之后).

我也试过内联声明凭证(即使它不太理想),如下所示:

Credentials.add("Repository Snapshots", "nexusHostIp", "nexususername", "nexuspassword")
Run Code Online (Sandbox Code Playgroud)

nexus ivy sbt

44
推荐指数
4
解决办法
3万
查看次数

尝试从Artifactory虚拟仓库下载时,SBT无法找到凭据

我正试图在公司防火墙后面运行SBT.另一个团队配置了Artifactory代理.这个代理可以正常启用匿名访问,但是当我们让它需要密码时,认为开始出错了.

当我在工作站上运行SBT时,出现以下错误:

[error] Unable to find credentials for [Artifactory Realm @ coderepo.xxx.amrs.bigco.com]
Run Code Online (Sandbox Code Playgroud)

结果是我无法引导sbt:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-lang#scala-library;2.10.6: not found
[warn]  :: org.scala-sbt#sbt;0.13.12: not found
[warn]  :: org.scala-lang#scala-compiler;2.10.6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
Run Code Online (Sandbox Code Playgroud)

我已经尝试在./ .sbt和〜/ .ivy2中放置一个.credentials文件:我一直在测试以下内容的变体,所有这些都不起作用:

realm=Artifactory Realm @ coderepo.xxx.amrs.bigco.com
host=coderepo.xxx.amrs.bigco.com
user=<username>
password=<pwd>
Run Code Online (Sandbox Code Playgroud)

我猜这个错误意味着它无法找到与领域匹配的凭据定义,所以我在两个位置尝试了第一行的多个版本:

realm=Artifactory Realm
realm=[Artifactory Realm @ coderepo.xxx.amrs.bigco.com]
realm=coderepo.xxx.amrs.bigco.com
Run Code Online (Sandbox Code Playgroud)

这些似乎都没有任何影响.

那么,允许SBT使用用户名和密码对受密码保护的Artifactory存储库进行身份验证的正确方法是什么?

UPDATE0:根据常春藤文档,最可能的领域名称只是"Artifactory Realm".根据SBT文档,凭证文件的正确默认位置应为%USERPROFILE%/.sbt/.credentials(是的,我使用的是Windows).即使在删除.ivy2目录中的.credentials文件后,它仍然无效.

更新1:相关但实际上并没有帮助:

UPDATE2:我开始怀疑这是sbt中的一个错误 - 我在这里添加了一个问题:https://github.com/sbt/sbt/issues/2817

scala artifactory sbt

9
推荐指数
2
解决办法
1万
查看次数

如何从Windows工作站向我的专用Artifactory服务器提供SBT凭证?

我正在Windows桌面上的公司防火墙后面使用sbt 0.13.13。

我们有一个Artifactory,似乎在其他构建工具上工作得很好,但我也想使SBT正常工作,但是我什至无法启动sbt 0.13.x!

当我尝试启动SBT时,我从启动器中收到此错误:

C:\workspace\aggregator2>c:\apps\sbt-0.13.13\sbt-launcher-packaging-0.13.13\bin\sbt
Getting org.scala-sbt sbt 0.13.13 ...

:: problems summary ::
:::: WARNINGS
                module not found: org.scala-sbt#sbt;0.13.13

        ==== local: tried

          C:\Users\USERNAME\.ivy2\local\org.scala-sbt\sbt\0.13.13\ivys\ivy.xml

          -- artifact org.scala-sbt#sbt;0.13.13!sbt.jar:

          C:\Users\USERNAME\.ivy2\local\org.scala-sbt\sbt\0.13.13\jars\sbt.jar

        ==== my-ivy-proxy-releases: tried

          http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org.scala-sbt/sbt/0.13.13/ivys/ivy.xml

        ==== my-maven-proxy-releases: tried

          http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org/scala-sbt/sbt/0.13.13/sbt-0.13.13.pom

          -- artifact org.scala-sbt#sbt;0.13.13!sbt.jar:

          http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org/scala-sbt/sbt/0.13.13/sbt-0.13.13.jar

                ::::::::::::::::::::::::::::::::::::::::::::::

                ::          UNRESOLVED DEPENDENCIES         ::

                ::::::::::::::::::::::::::::::::::::::::::::::

                :: org.scala-sbt#sbt;0.13.13: not found

                ::::::::::::::::::::::::::::::::::::::::::::::
Run Code Online (Sandbox Code Playgroud)

实际上,这些URL确实存在-当我用Chrome或Curl打入它们并提供凭据时,我便能够检索所有必需的资源。

当我查看日志时,可以看到发生了什么:

try to get credentials for: Artifactory Realm@artifactory.bigcompany.com
authentication: k='Artifactory Realm@artifactory.bigcompany.com' c='null'
HTTP response status: 401 url=http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org.scala-sbt/sbt/0.13.13/ivys/ivy.xml
CLIENT ERROR: Unauthorized url=http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org.scala-sbt/sbt/0.13.13/ivys/ivy.xml
    my-ivy-proxy-releases: resource not reachable for org.scala-sbt#sbt;0.13.13: …
Run Code Online (Sandbox Code Playgroud)

scala artifactory sbt

4
推荐指数
1
解决办法
4271
查看次数

SBT凭证配置应该去哪里?

我在Windows上运行SBT 1.1.1。

如果将以下行放入build.sbt中,则构建正常:

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
Run Code Online (Sandbox Code Playgroud)

问题是,我不想在项目中保留这种特定于机器的配置。另外,为了使用g8模板,我需要有一个有效的全局配置。

但是,如果我将相同的文本放在以下目录中的名为certificate.sbt的文件中,则似乎无法正常工作。

  • %USERPROFILE%/。sbt / 1.1 / plugins / credentials.sbt
  • %USERPROFILE%/。sbt / 1.1 / credentials.sbt
  • %USERPROFILE%/。sbt / plugins / credentials.sbt

那么该文件应该放在哪里?

我将文件放在任何位置,都会出现以下错误:

C:\workspace\tmp>c:\apps\sbt-1.1.1\bin\sbt.bat new sbt/scala-seed.g8
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading settings from credentials.sbt ...
[info] Loading global plugins from C:\Users\NBKA0O5\.sbt\1.0\plugins
[info] Updating ProjectRef(uri("file:/C:/Users/NBKA0O5/.sbt/1.0/plugins/"), "global-plugins")...
[error] Unable to find credentials for [Artifactory Realm @ artifactory.company.com].
[error] Unable to find …
Run Code Online (Sandbox Code Playgroud)

sbt

4
推荐指数
1
解决办法
968
查看次数

标签 统计

sbt ×4

artifactory ×2

scala ×2

ivy ×1

nexus ×1