如何从Windows工作站向我的私有Artifactory服务器提供SBT凭证? [英] How can I provide SBT credentials to my private Artifactory server from a Windows workstation?

查看:128
本文介绍了如何从Windows工作站向我的私有Artifactory服务器提供SBT凭证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using sbt 0.13.13 behind a corporate firewall on a Windows desktop.

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

We have an Artifactory which seems to be working very well for other build-tools, but I also want to get SBT working, however I'm not even able to make sbt 0.13.x boot!

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

When I try to boot SBT I get this error from the launcher:

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

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

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

Actually those URLs do exist - when I hit them with Chrome or Curl and provide credentials I am able to retrieve all the required resources.

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

When I look at the log I can see what's going on:

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: res=http://artifactory.bigcompany.com:8081/artifactory/virtual-sbt/org.scala-sbt/sbt/0.13.13/ivys/ivy.xml
    my-ivy-proxy-releases: no ivy file found for org.scala-sbt#sbt;0.13.13

因此很明显,没有凭据(或发送了错误的凭据).所以我看了如何设置它.我在%USERPROFILE%/.sbt/.credentials

So it's clear that no credentials (or the wrong credentials are being sent). So I looked at how I've got it set up. I have a credentials file which looks something like this in %USERPROFILE%/.sbt/.credentials

realm=Artifactory Realm
host=artifactory.bigcompany.com
user=USERNAME
password=<my api key>

我在%USERPROFILE%.sbt \ 0.13 \ plugins \ credentials.sbt 中有一个插件"文件,看起来像这样:

And I have a "plugin" file located at %USERPROFILE%.sbt\0.13\plugins\credentials.sbt which looks like this:

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")

我正在像这样调用sbt:

And I'm invoking sbt like this:

c:\apps\sbt-0.13.13\sbt-launcher-packaging-0.13.13\bin\sbt

再次查看日志-根本没有任何迹象表明凭据已加载了crss.sbt插件,这反过来又表明我将文件放置在错误的位置,或者存在其他问题使其无法使用

Looking again at the logs - there's nothing at all which suggests that the credentials.sbt plugin has loaded, which in turn suggests that I've put the file in the wrong location or that there's something else about it that makes it unusable.

所以有人可以帮助我-我需要如何调整此设置以使其真正起作用?是否缺少

So can somebody help me - how do I need to tweak this setup so that it actually works? Is there some missing

推荐答案

我认为我遇到了同样的问题.

I think I've encountered the same problem.

由于您已经在%USERPROFILE%/.sbt/.credentials下创建了适当的凭据文件,因此可能需要设置系统或用户环境变量:

Since you've already created a proper credential file under %USERPROFILE%/.sbt/.credentials, you might need to set a system or user environment variable:

set SBT_CREDENTIALS=%USERPROFILE%/.sbt/.credentials

这篇关于如何从Windows工作站向我的私有Artifactory服务器提供SBT凭证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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