Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I set proxy for SBT in Intellij IDEA?

I am using Intellij IDEA 14.1.3 edition and have installed Scala plugin. When creating SBT project, it reports the following error:

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 SBT setting screen:
enter image description here

I can't find a place to set proxy. Where can I set proxy for SBT in Intellij IDEA?

like image 305
Nan Xiao Avatar asked Jun 16 '15 07:06

Nan Xiao


People also ask

Where do I put proxy in IntelliJ?

Configure proxy settings directly from IntelliJ IDEA. Do the following: Open the Version Control | Subversion | Network page of the IDE settings Ctrl+Alt+S . Click the Edit Network Options button and specify the proxy settings in the Edit Subversion Options Related to Network Layers dialog that opens.

Where is Plugins SBT in IntelliJ?

IntelliJ plugin can be found here http://confluence.jetbrains.com/display/SCA/Scala+Plugin+for+IntelliJ+IDEA or can be installed directoly from within the IDE using Settings -> Plugins dialog. Afterwards one can just do File -> New Project -> Scala -> SBT based. IntelliJ will generate basic build.


3 Answers

Add -Dhttp.proxyHost=<proxy_server> -Dhttp.proxyPort=<proxy_port> to VM parameters

Read documentation for more info

like image 180
Sergii Lagutin Avatar answered Oct 08 '22 05:10

Sergii Lagutin


Basically there are three ways of setting the proxy. Each of them seems to affect a different part of the IDE.

For all following three methods I recommend setting both, http and https, since most connections to repos are established using https nowadays:

-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

Setting the proxy under "Build, Execution, Deployment" > "Build Tools" > "SBT" > "VM parameters" affects the SBT process that is executed after editing the build.sbt file 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.

2. Other Settings

Aditionally, I used the setting under "Other Settings" > "SBT" > "VM parameters"

Setting VM parameters

3. Setting the proxy globally

Another way would be to set the proxy settings globally with your JAVA_OPTS as described here.

like image 15
Boern Avatar answered Oct 08 '22 05:10

Boern


Add parameter VM

-Dhttps.proxyHost=hostName 
-Dhttps.proxyPort=portUse 
-Dhttps.proxyUser=proxyName 
-Dhttps.proxyPassword=proxyPaword

It work for me

like image 10
Wisarut Yeamsup Avatar answered Oct 08 '22 04:10

Wisarut Yeamsup