scala 我在哪里可以在 Intellij IDEA 中为 SBT 设置代理?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30860940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where can I set proxy for SBT in Intellij IDEA?
提问by Nan Xiao
I am using Intellij IDEA 14.1.3edition and have installed Scalaplugin. When creating SBTproject, it reports the following error:
我正在使用Intellij IDEA 14.1.3版本并安装了Scala插件。创建SBT项目时,报如下错误:
Error:Error while importing SBT project:
...
::::::::::::::::::::::::::::::::::::::::::::::
:: org.fusesource.jansi#jansi;1.11: not found
::::::::::::::::::::::::::::::::::::::::::::::
:::: ERRORS
Server access Error: Connection timed out: connect url=http://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
Server access Error: Connection timed out: connect url=http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
Server access Error: Connection timed out: connect url=http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.fusesource.jansi#jansi;1.11: not found
Error during sbt execution: Error retrieving required libraries
(see C:\Users\xiaona\.sbt\boot\update.log for complete log)
Error: Could not retrieve jansi 1.11
See complete log in C:\Users\xiaona\.IdeaIC14\system\log\sbt.last.log
After referring this post, I see the root cause should be that I use proxy to connect internet.
参考这篇文章后,我看到根本原因应该是我使用代理连接互联网。
But in SBTsetting screen:
但是在SBT设置屏幕中:
I can't find a place to set proxy. Where can I set proxy for SBTin Intellij IDEA?
我找不到设置代理的地方。在哪里可以设置SBTin 的代理Intellij IDEA?
回答by Sergii Lagutin
Add -Dhttp.proxyHost=<proxy_server> -Dhttp.proxyPort=<proxy_port>to VM parameters
添加-Dhttp.proxyHost=<proxy_server> -Dhttp.proxyPort=<proxy_port>到 VM 参数
Read documentationfor more info
阅读文档了解更多信息
回答by Boern
Basically there are three ways of setting the proxy. Each of them seems to affect a different part of the IDE.
基本上有三种设置代理的方法。它们中的每一个似乎都会影响 IDE 的不同部分。
For all following three methods I recommend setting both, httpand https, since most connections to repos are established using httpsnowadays:
对于以下所有三种方法,我建议同时设置http和https,因为大多数与存储库的连接都是使用https现在建立的:
-Dhttp.proxyHost=yourProxyAdress
-Dhttp.proxyPort=yourPort
-Dhttp.proxyUser=yourUsername
-Dhttp.proxyPassword=yourPassword
-Dhttps.proxyHost=yourProxyAdress
-Dhttps.proxyPort=yourPort
-Dhttps.proxyUser=yourUsername
-Dhttps.proxyPassword=yourPassword
1. Build Tools
1. 构建工具
Setting the proxy under "Build, Execution, Deployment" > "Build Tools" > "SBT" > "VM parameters" affects the SBT process that is executed after editing the build.sbtfile and refreshing the latter. Also, this is used for indexing (and therefore auto completion). This setting will also affect the download of SBT itself in the version you selected during project setup.
在“构建、执行、部署”>“构建工具”>“SBT”>“VM 参数”下设置代理会影响编辑build.sbt文件并刷新后者后执行的SBT 进程。此外,这用于索引(因此自动完成)。此设置还将影响您在项目设置期间选择的版本中的 SBT 本身的下载。
2. Other Settings
2. 其他设置
Aditionally, I used the setting under "Other Settings" > "SBT" > "VM parameters"
另外,我使用了“其他设置”>“SBT”>“VM 参数”下的设置
3. Setting the proxy globally
3.全局设置代理
Another way would be to set the proxy settings globally with your JAVA_OPTSas described here.
另一种方法是使用您JAVA_OPTS在此处描述的全局设置代理设置。
回答by Wisarut Yeamsup
Add parameter VM
添加参数VM
-Dhttps.proxyHost=hostName
-Dhttps.proxyPort=portUse
-Dhttps.proxyUser=proxyName
-Dhttps.proxyPassword=proxyPaword
It work for me
它对我有用
回答by Atais
回答by Javier Morant
回答by Deej
I was seeing this same error message and tried all the suggestions mentioned in multiple (related) threads. I was able to finally resolve the problem by setting up the HTTP Proxy directly in IntelliJ. Here's what my settings look like (Note: specify your network username and password in the corresponding boxes):-
我看到了同样的错误消息,并尝试了多个(相关)线程中提到的所有建议。通过直接在 IntelliJ 中设置 HTTP 代理,我最终解决了这个问题。这是我的设置的样子(注意:在相应的框中指定您的网络用户名和密码):-

