sbt 1.x proxy problem

Created on 7 Aug 2018  路  3Comments  路  Source: sbt/sbt

steps

As far as I know sbt obeys the JVM arguments and I have configured the proxy arguments in the Ubuntu ~/.profile as below:

export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=host -Dhttp.proxyPort=port -Dhttp.proxyUser=username -Dhttp.proxyPassword=password -Dhttps.proxyHost=host -Dhttps.proxyPort=port -Dhttps.proxyUser=username -Dhttps.proxyPassword=password -Djdk.http.auth.proxying.disabledSchemes= -Djdk.http.auth.tunneling.disabledSchemes="

export SBT_OPTS="$SBT_OPTS -server -Xms512M -Xmx3000M -Xss1M -XX:+UseConcMarkSweepGC -XX:NewRatio=8"

problem

I can't download dependencies behind proxy authentication with sbt 1.x

thiago@thiago-ubuntu1804:~/Development/Projects/scala-sbt-quickstart$ sbt
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /home/thiago/.sbt/1.0/plugins
[info] Loading project definition from /home/thiago/Development/Projects/scala-sbt-quickstart/project
[info] Loading settings for project scala-sbt-quickstart from build.sbt ...
[info] Set current project to scala-sbt-quickstart (in build file:/home/thiago/Development/Projects/scala-sbt-quickstart/)
[info] sbt server started at local:///home/thiago/.sbt/1.0/server/0197c7c236c8112da847/sock
sbt:scala-sbt-quickstart> compile
[info] Compiling 1 Scala source to /home/thiago/Development/Projects/scala-sbt-quickstart/target/scala-2.12/classes ...
[info] Attempting to fetch org.scala-sbt:compiler-bridge_2.12:1.2.1.
[warn] Your proxy requires authentication.
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-sbt#compiler-bridge_2.12;1.2.1: public: unable to get resource for org/scala-sbt#compiler-bridge_2.12;1.2.1: res=https://repo1.maven.org/maven2/org/scala-sbt/compiler-bridge_2.12/1.2.1/compiler-bridge_2.12-1.2.1.pom: java.io.IOException: Failed to authenticate with proxy
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] ## Exception when compiling 1 sources to /home/thiago/Development/Projects/scala-sbt-quickstart/target/scala-2.12/classes
[error] The compiler bridge sources org.scala-sbt:compiler-bridge_2.12:1.2.1:compile could not be retrieved.
...

expectation

Be able to download all necessary dependencies with sbt 1.x behind proxy authentication.

notes

This problem only occurs with version 1.x of sbt, when changed to version 0.13.x everything works correctly as below:

thiago@thiago-ubuntu1804:~/Development/Projects/scala-sbt-quickstart$ sbt
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[info] Loading project definition from /home/thiago/Development/Projects/scala-sbt-quickstart/project
[info] Updating {file:/home/thiago/Development/Projects/scala-sbt-quickstart/project/}scala-sbt-quickstart-build...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by sbt.ivyint.ErrorMessageAuthenticator$ (file:/home/thiago/.sbt/boot/scala-2.10.6/org.scala-sbt/sbt/0.13.15/ivy-0.13.15.jar) to field java.net.Authenticator.theAuthenticator
WARNING: Please consider reporting this to the maintainers of sbt.ivyint.ErrorMessageAuthenticator$
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to scala-sbt-quickstart (in build file:/home/thiago/Development/Projects/scala-sbt-quickstart/)
> compile
[info] Updating {file:/home/thiago/Development/Projects/scala-sbt-quickstart/}scala-sbt-quickstart...
[info] Resolving jline#jline;2.14.6 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/thiago/Development/Projects/scala-sbt-quickstart/target/scala-2.12/classes...
[success] Total time: 3 s, completed 7 de ago de 2018 08:50:08
> sbtVersion
[info] 0.13.15
> 

sbt version: 1.2.1
jdk version: 10.0.2

areproxy_network

Most helpful comment

sbt uses Gigahorse with OkHttp for parallel downloading. You can try turning it off by passing -Dsbt.gigahorse=false.

Another thing you could try is turning off https, and use http by passing -Dsbt.repository.secure=false.

Ref https://github.com/square/okhttp/issues/3787

All 3 comments

sbt uses Gigahorse with OkHttp for parallel downloading. You can try turning it off by passing -Dsbt.gigahorse=false.

Another thing you could try is turning off https, and use http by passing -Dsbt.repository.secure=false.

Ref https://github.com/square/okhttp/issues/3787

@eed3si9n thank you so much!! It worked like a charm.

I updated my .profile:

export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=hostname -Dhttp.proxyPort=port -Dhttp.proxyUser=username -Dhttp.proxyPassword=password -Djdk.http.auth.proxying.disabledSchemes= -Djdk.http.auth.tunneling.disabledSchemes= -Dsbt.repository.secure=false -Dsbt.gigahorse=false"

export SBT_OPTS="-server -Xms512M -Xmx3000M -Xss1M -XX:+UseConcMarkSweepGC -XX:NewRatio=8"

And compile my project

thiago@thiago-ubuntu1804:~$ cd Development/Projects/scala-sbt-quickstart/
thiago@thiago-ubuntu1804:~/Development/Projects/scala-sbt-quickstart$ cat project/build.properties 
sbt.version=1.2.1
thiago@thiago-ubuntu1804:~/Development/Projects/scala-sbt-quickstart$ sbt
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /home/thiago/.sbt/1.0/plugins
[info] Loading project definition from /home/thiago/Development/Projects/scala-sbt-quickstart/project
[info] Updating ProjectRef(uri("file:/home/thiago/Development/Projects/scala-sbt-quickstart/project/"), "scala-sbt-quickstart-build")...
[info] Done updating.
[info] Loading settings for project scala-sbt-quickstart from build.sbt ...
[info] Set current project to scala-sbt-quickstart (in build file:/home/thiago/Development/Projects/scala-sbt-quickstart/)
[info] sbt server started at local:///home/thiago/.sbt/1.0/server/0197c7c236c8112da847/sock
sbt:scala-sbt-quickstart> sbtVersion
[info] 1.2.1
sbt:scala-sbt-quickstart> compile
[info] Updating ...
[info] downloading http://repo1.maven.org/maven2/com/typesafe/config/1.3.3/config-1.3.3.jar ...
[info]  [SUCCESSFUL ] com.typesafe#config;1.3.3!config.jar(bundle) (8737ms)
[info] Done updating.
[info] Compiling 1 Scala source to /home/thiago/Development/Projects/scala-sbt-quickstart/target/scala-2.12/classes ...
[info] Done compiling.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/thiago/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.2.1/protobuf-java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[success] Total time: 13 s, completed 10 de ago de 2018 10:56:35
sbt:scala-sbt-quickstart> exit
[info] shutting down server
thiago@thiago-ubuntu1804:~/Development/Projects/scala-sbt-quickstart$ 

Closing this as a duplicate of https://github.com/sbt/sbt/issues/3696

Was this page helpful?
0 / 5 - 0 ratings