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

问题描述

我正在尝试在 Windows 7 上运行SBT.为此,我遵循类似线程"如何从后面使用sbt的步骤.代理?".

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

Variable name: JAVA_OPTS Variable value: -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

Variable name: SBT_OPTS Variable value: -Dhttp.proxySet=true -Dhttp.proxyHost=192.168.0.150 -Dhttp.proxyPort=8080

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

Variable name: SBT_HOME Variable value: C:\Program Files (x86)\sbt\

我还更改了C:\Program Files (x86)\sbt\conf\sbtconfig.txt

*将Java参数设置为高

*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

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

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

::::错误服务器访问错误:连接超时:连接 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:

{

错误":[{

状态":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)

按以下顺序对设置进行优先排序:

The settings are prioritized in the following order:

SBT_OPTS覆盖JAVA_OPTS覆盖%SBT_HOME%conf \ sbtconfig.txt

SBT_OPTS overrides JAVA_OPTS overrides %SBT_HOME%conf\sbtconfig.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

OR

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%conf \ sbtconfig.txt文件:

OR to edit the %SBT_HOME%conf\sbtconfig.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 *****

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

09-22 08:09