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

查看:3510
本文介绍了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社区(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:\ Users \ Rk.IdeaIC2016 \ system \\ \\ log\sbt.last.log


See complete log in C:\Users\Rk.IdeaIC2016\system\log\sbt.last.log

经过一段时间的修补,我发现当我输入关于在终端,我被告知我有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.

A看似更正确,但更复杂的修复方法包括从您使用的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天全站免登陆