如何在代理后面使用 sbt - 在 Windows 7 中? [英] How to use sbt from behind proxy - in windows 7?

查看:25
本文介绍了如何在代理后面使用 sbt - 在 Windows 7 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 7 上运行 SBT.为此,我按照类似线程How to use sbt from behind代理?.

I am trying to run SBT on Windows 7. To do so I followed the steps in the similar thread "How to use sbt from behind proxy?".

我有以下相关的系统变量":

I have the following relevant "System variables":

变量名:JAVA_OPTS变量值:-Dhttp.proxySet=true -Dhttp.proxyHost=192.168.0.150 -Dhttp.proxyPort=8080

变量名:SBT_OPTS变量值:-Dhttp.proxySet=true -Dhttp.proxyHost=192.168.0.150 -Dhttp.proxyPort=8080

变量名:SBT_HOME变量值:C:Program Files (x86)sbt

我还修改了C:Program Files (x86)sbtconfsbtconfig.txt的内容

***** sbtconfig.txt 开始 *****

***** sbtconfig.txt BEGINNING *****

*将 java args 设置为高

*Set the java args to high

-Xmx512M

-XX:MaxPermSize=256m

-XX:MaxPermSize=256m

-XX:ReservedCodeCacheSize=128m

-XX:ReservedCodeCacheSize=128m

*设置额外的 SBT 选项

*Set the extra SBT options

-Dsbt.log.format=true

-Dsbt.log.format=true

*设置代理

-Dhttp.proxySet=true

-Dhttp.proxySet=true

-Dhttp.proxyHost=192.168.0.150

-Dhttp.proxyHost=192.168.0.150

-Dhttp.proxyPort=8080

-Dhttp.proxyPort=8080

***** sbtconfig.txt END *****

***** sbtconfig.txt END *****

运行cmd.exe 我输入sbt.cmd回显

Running cmd.exe I enter sbt. The cmd echos

获取 org.fusesource.jansi jansi 1.11 ....

Getting org.fusesource.jansi jansi 1.11 ....

大约 1 分钟后,我收到很多警告和错误,例如:

After around 1 minute i get a lot of warnings and errors like:

[...]

:::: ERRORS 服务器访问错误:连接超时:连接url=https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11.ivys/ivy.xml

:::: ERRORS Server access Error: Connection timed out: connect url=https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11.ivys/ivy.xml

[...]

这与没有代理设置的情况完全相同.当我在浏览器中输入上述地址时,我也很惊讶,我得到的只是:

which is exactly the same I get without the proxy settings. Also I was surprised when I entered the mentioned address in my browser and all I got was:

***** 浏览器显示开始 *****

***** Browser display BEGINNING *****

{

错误":[ {

状态":404,

消息":找不到文件."

"message" : "File not found."

}]

}

***** 浏览器显示 END *****

***** Browser display END *****

我如何确定 SBT 是否正在尝试使用代理,或者是否存在其他问题?

How can I find out if SBT is even trying to use the proxy, or there is a different problem?

推荐答案

感谢 Paweł 的回答.

Thank you Paweł for your answer.

这是我发现的:

"-Dhttp.proxySet=true" 没有任何效果(至少对我而言)

"-Dhttp.proxySet=true" doesn't have any effect (for me at least)

设置的优先顺序如下:

SBT_OPTS 覆盖 JAVA_OPTS 覆盖 %SBT_HOME%confsbtconfig.txt

SBT_OPTS overrides JAVA_OPTS overrides %SBT_HOME%confsbtconfig.txt

解决方案是设置环境变量之一

The Solution is either to set one of the environmental variables

JAVA_OPTS=-Dhttp.proxyHost=192.168.0.150 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=192.168.0.150 -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost

SBT_OPTS=-Dhttp.proxyHost=192.168.0.150 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=192.168.0.150 -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost

或者编辑 %SBT_HOME%confsbtconfig.txt 文件:

OR to edit the %SBT_HOME%confsbtconfig.txt file :

***** sbtconfig.txt BEGINNING (hashtags in this file have been replaced by stars) *****

*Set the java args to high

-Xmx512M

*-XX:MaxPermSize=256m

-XX:ReservedCodeCacheSize=128m

*Set the extra SBT options

-Dsbt.log.format=true

*Proxy settings

-Dhttp.proxyHost=192.168.0.150 

-Dhttp.proxyPort=8080

-Dhttps.proxyHost=192.168.0.150 

-Dhttps.proxyPort=8080

***** sbtconfig.txt END *****

这篇关于如何在代理后面使用 sbt - 在 Windows 7 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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