0
votes

Using Windows 7, 64bit, behind a proxy server.

I have downloaded and installed the latest versions of SBT(0.13.11), Scala(2.11.8), and IntelliJ IDEA Community(2016.1.2). When I try to start a new project in IntelliJ, the newest version of SBT I can use is 0.13.8, not 0.13.11. Does anyone know why this might be? If I try to start a new project I get an error:

Error:Error while importing SBT project:
...

[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-lang#scala-library;2.11.8: not found
[warn]  :: org.scala-lang#scala-compiler;2.11.8: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      org.scala-lang:scala-library:2.11.8 ((sbt.Classpaths) Defaults.scala#L1203)
[warn]        +- default:untitled1_2.11:1.0
[warn]      org.scala-lang:scala-compiler:2.11.8
[warn]        +- default:untitled1_2.11:1.0
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last :ssExtractDependencies' for the full output.
[error] (:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.8: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.8: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.8: not found
[error] Total time: 4 s, completed May 25, 2016 10:51:00 AM
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true

See complete log in C:\Users\Rk.IdeaIC2016\system\log\sbt.last.log

After tinkering for a while, I discovered that when I type sbt about at the terminal, I am told that I have SBT version 0.13.8, which is built against Scala 2.10.4. That doesn't look right! If I go into IntelliJ and choose the SBT build as 0.13.8 and Scala build as 2.10.4, I get no error!!

So, this is pretty confusing because it's not clear whether the proxy is the issue or not. It seems like if I could just update SBT to version 0.13.11 the whole thing would work.

Any insight or help would be greatly appreciated - I am excited to learn Scala but these technical difficulties are stopping me.

EDIT: When I run sbt compile in the project directory, I receive the following output: enter image description here

3

3 Answers

5
votes

There's one red line your sbt's output:

[error] Server access Error: Connection refused: connect url=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.pom

It happens because you're behind a proxy, and starting with version 0.13.9, sbt by default uses https for all connections. sbt 0.13.8 still uses http, that's why this problem doesn't manifest in this version.

The easiest way to cope with this problem is to modify your sbt.bat script and add an argument to the command line which launches sbt executable:

-Dsbt.repository.secure=false

This command forces sbt to use http instead.

A seemingly more correct, but much more complex way to fix involves manual extraction of https certificates from maven repositories you use and their installation into your JDK's cacerts keystore using keytool - however this complex way doesn't seem to cover all cases, while turning https off completely works like a charm.

0
votes

Assume in your <project-name>/project folder there is an build.properties file with one property sbt.version=0.13.8

0
votes

There seems to be a Problem with sbt 0.13.11 using the wrong configuration. I could only make it work by putting the https Proxy settings into the http parameters.

So it indeed uses https for every connection but ignores https Proxy parameters.