SBT 0.13.11 无法下载代理后面的依赖项 [英] SBT 0.13.11 cannot download dependencies behind a proxy

查看:43
本文介绍了SBT 0.13.11 无法下载代理后面的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Windows 7,64 位,在代理服务器后面.

Using Windows 7, 64bit, behind a proxy server.

我已经下载并安装了最新版本的 SBT(0.13.11)、Scala(2.11.8) 和 IntelliJ IDEA Community(2016.1.2).当我尝试在 IntelliJ 中开始一个新项目时,我可以使用的最新版本的 SBT 是 0.13.8,而不是 0.13.11.有谁知道为什么会这样?如果我尝试开始一个新项目,我会收到一个错误:

I have downloaded and installed the latest versions of SBT(0.13.11), Scala(2.11.8), and IntelliJ IDEA Community(2016.1.2). When I try to start a new project in IntelliJ, the newest version of SBT I can use is 0.13.8, not 0.13.11. Does anyone know why this might be? If I try to start a new project I get an error:

错误:导入 SBT 项目时出错:
...

Error:Error while importing SBT project:
...

[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-lang#scala-library;2.11.8: not found
[warn]  :: org.scala-lang#scala-compiler;2.11.8: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      org.scala-lang:scala-library:2.11.8 ((sbt.Classpaths) Defaults.scala#L1203)
[warn]        +- default:untitled1_2.11:1.0
[warn]      org.scala-lang:scala-compiler:2.11.8
[warn]        +- default:untitled1_2.11:1.0
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last :ssExtractDependencies' for the full output.
[error] (:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.8: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.8: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: not found
[error] Total time: 4 s, completed May 25, 2016 10:51:00 AM
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true


在C:UsersRk.IdeaIC2016systemlogsbt.last.log查看完整日志


See complete log in C:UsersRk.IdeaIC2016systemlogsbt.last.log

修改了一段时间后,我发现当我在终端输入 sbt about 时,我被告知我有 SBT 版本 0.13.8,它是针对 Scala 2.10.4 构建的.那看起来不对啊!如果我进入 IntelliJ 并选择 SBT 构建为 0.13.8 和 Scala 构建为 2.10.4,我不会出错!!

After tinkering for a while, I discovered that when I type sbt about at the terminal, I am told that I have SBT version 0.13.8, which is built against Scala 2.10.4. That doesn't look right! If I go into IntelliJ and choose the SBT build as 0.13.8 and Scala build as 2.10.4, I get no error!!

所以,这很令人困惑,因为不清楚代理是否是问题所在.似乎如果我可以将 SBT 更新到 0.13.11 版,整个事情就会起作用.

So, this is pretty confusing because it's not clear whether the proxy is the issue or not. It seems like if I could just update SBT to version 0.13.11 the whole thing would work.

任何见解或帮助将不胜感激 - 我很高兴学习 Scala,但这些技术困难阻止了我.

Any insight or help would be greatly appreciated - I am excited to learn Scala but these technical difficulties are stopping me.

当我在项目目录中运行 sbt compile 时,我收到以下输出:

When I run sbt compile in the project directory, I receive the following output:

推荐答案

你的 sbt 的输出有一条红线:

There's one red line your sbt's output:

[error] Server access Error: Connection refused: connect url=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.pom

发生这种情况是因为您使用了代理,并且从 0.13.9 版本开始,默认情况下 sbt 对所有连接都使用 https.sbt 0.13.8 仍然使用http,所以这个版本没有出现这个问题.

It happens because you're behind a proxy, and starting with version 0.13.9, sbt by default uses https for all connections. sbt 0.13.8 still uses http, that's why this problem doesn't manifest in this version.

解决这个问题最简单的方法是修改你的 sbt.bat 脚本,并在启动 sbt 可执行文件的命令行中添加一个参数:

The easiest way to cope with this problem is to modify your sbt.bat script and add an argument to the command line which launches sbt executable:

-Dsbt.repository.secure=false

此命令强制 sbt 使用 http.

This command forces sbt to use http instead.

一种看似更正确但更复杂的修复方法涉及从您使用的 maven 存储库中手动提取 https 证书,并使用 keytool 将它们安装到 JDK 的 cacerts 密钥库中 - 但是这种复杂的方法似乎并未涵盖所有情况,同时完全关闭 https 就像一个魅力.

A seemingly more correct, but much more complex way to fix involves manual extraction of https certificates from maven repositories you use and their installation into your JDK's cacerts keystore using keytool - however this complex way doesn't seem to cover all cases, while turning https off completely works like a charm.

这篇关于SBT 0.13.11 无法下载代理后面的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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