Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use sbt from behind proxy - in windows 7?

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":

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

and

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

I also changed the content of C:\Program Files (x86)\sbt\conf\sbtconfig.txt

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

*Set the java args to high

-Xmx512M

-XX:MaxPermSize=256m

-XX:ReservedCodeCacheSize=128m

*Set the extra SBT options

-Dsbt.log.format=true

*Set proxy

-Dhttp.proxySet=true

-Dhttp.proxyHost=192.168.0.150

-Dhttp.proxyPort=8080

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

Running cmd.exe I enter sbt. The cmd echos

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

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

[...]

:::: 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 *****

{

"errors" : [ {

"status" : 404,

"message" : "File not found."

} ]

}

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

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

like image 995
ribi86 Avatar asked Nov 25 '14 13:11

ribi86


2 Answers

Thank you Paweł for your answer.

This is what I found out:

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

The settings are prioritized in the following order:

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

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 *****
like image 105
ribi86 Avatar answered Oct 21 '22 13:10

ribi86


Let's take a look at your errors:

:::: 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

Sbt is trying to use https, but you don't have proxy configuration for it. Try setting https proxy variables:

  • https.proxyHost
  • https.proxyPort

I guess you could try the same values as for http proxy.

like image 43
Pawel Batko Avatar answered Oct 21 '22 12:10

Pawel Batko