Support Questions

Find answers, ask questions, and share your expertise

Problem with proxy settings for SBT

avatar
Expert Contributor

I am trying to use Scala/Spark from IntelliJ in Windows 7, but it IntelliJ (and SBT command line) fails to download files. I am behind a proxy server.

Similar problems were already reported here.

Already tried:

- SBT versions 0.13.16, 1.0.3 and 1.1.1

- setting proxy properties JAVA_OPTS, SBT_OPTS, sbtconfigtxt

-Dhttp.proxyHost=***-Dhttp.proxyPort=***-Dhttp.proxyUser=***-Dhttp.proxyPassword=***-Dhttps.proxyHost=***-Dhttps.proxyPort=***-Dhttps.proxyUser=***-Dhttps.proxyPassword=***

without success

- verified the issue in SBT:

d:\Users\user1>sbt.bat
[info] Loading project definition from D:\Users\user1\project
[info] Updating {file:/D:/Users/user1/project/}user1-build...
[warn]  [FAILED     ] org.apache.logging.log4j#log4j-core;2.8.1!log4j-core.jar(t
est-jar): typesafe-ivy-releases: unable to get resource for org.apache.logging.l
og4j#log4j-core;2.8.1: res=https://repo.typesafe.com/typesafe/ivy-releases/org.a
pache.logging.log4j/log4j-core/2.8.1/test-jars/log4j-core-tests.jar: java.io.IOE
xception: Failed to authenticate with proxy (353ms)
[warn]  [FAILED     ] org.apache.logging.log4j#log4j-core;2.8.1!log4j-core.jar(t
est-jar): sbt-plugin-releases: unable to get resource for org.apache.logging.log
4j#log4j-core;2.8.1: res=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases
/org.apache.logging.log4j/log4j-core/2.8.1/test-jars/log4j-core-tests.jar: java.
io.IOException: Failed to authenticate with proxy (8ms)
[warn]  [FAILED     ] org.apache.logging.log4j#log4j-core;2.8.1!log4j-core.jar(t
est-jar): public: unable to get resource for org/apache/logging/log4j#log4j-core
;2.8.1: res=https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2
.8.1/log4j-core-2.8.1-tests.jar: java.io.IOException: Failed to authenticate wit
h proxy (8ms)
[warn]  Detected merged artifact: [FAILED     ] org.apache.logging.log4j#log4j-c
ore;2.8.1!log4j-core.jar(test-jar):  (0ms).
[warn] ==== typesafe-ivy-releases: tried
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.apache.logg
ing.log4j/log4j-core/2.8.1/test-jars/log4j-core-tests.jar
[warn] ==== local: tried
[warn]   d:\Users\user1\.ivy2\local\org.apache.logging.log4j\log4j-core\2.8.1\
test-jars\log4j-core-tests.jar
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.8.
1/log4j-core-2.8.1-tests.jar
[warn] ==== local-preloaded-ivy: tried
[warn]   d:\Users\user1\.sbt\preloaded\org.apache.logging.log4j\log4j-core\2.8
.1\test-jars\log4j-core-tests.jar
[warn] ==== local-preloaded: tried
[warn]   file:/d:/Users/user1/.sbt/preloaded/org/apache/logging/log4j/log4j-co
re/2.8.1/log4j-core-2.8.1-tests.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.apache.logging.log4j#log4j-core;2.8.1!log4j-core.jar(test-jar)
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] sbt.librarymanagement.ResolveException: download failed: org.apache.logg
ing.log4j#log4j-core;2.8.1!log4j-core.jar(test-jar)
[error]         at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve
(IvyActions.scala:331)
[error]         at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEit
her$1(IvyActions.scala:205)
[error]         at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withMod
ule$1(Ivy.scala:229)
[error]         at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.
scala:190)
[error]         at sbt.internal.librarymanagement.IvySbt.sbt$internal$libraryman
agement$IvySbt$$action$1(Ivy.scala:70)
[error]         at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:
77)
[error]         at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error]         at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withCh
annelRetries$1(Locks.scala:80)
[error]         at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Lock
s.scala:99)
[error]         at xsbt.boot.Using$.withResource(Using.scala:10)
[error]         at xsbt.boot.Using$.apply(Using.scala:9)
[error]         at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scal
a:60)
[error]         at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error]         at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error]         at xsbt.boot.Locks$.apply(Locks.scala:28)
[error]         at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.s
cala:77)
[error]         at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:185)
[error]         at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:182)
[error]         at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.s
cala:228)
[error]         at sbt.internal.librarymanagement.IvyActions$.updateEither(IvyAc
tions.scala:190)
[error]         at sbt.librarymanagement.ivy.IvyDependencyResolution.update(IvyD
ependencyResolution.scala:20)
[error]         at sbt.librarymanagement.DependencyResolution.update(DependencyR
esolution.scala:56)
[error]         at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.s
cala:38)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(Libr
aryManagement.scala:91)
[error]         at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(Libr
aryManagement.scala:104)
[error]         at scala.util.control.Exception$Catch.apply(Exception.scala:224)


[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(Libr
aryManagement.scala:104)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adap
ted(LibraryManagement.scala:87)
[error]         at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error]         at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagemen
t.scala:118)
[error]         at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2353)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFuncti
ons.scala:42)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:64)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.sc
ala:16)
[error]         at sbt.Execute.work(Execute.scala:266)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(Con
currentRestrictions.scala:167)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:32
)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors
.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolE
xecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPool
Executor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? [error] (*:update)
 sbt.librarymanagement.ResolveException: download failed: org.apache.logging.log
4j#log4j-core;2.8.1!log4j-core.jar(test-jar)


1 ACCEPTED SOLUTION

avatar
Expert Contributor

A couple of considerations that solved this issue: if you use SBT 0.13.16 (not newer that that) and set Use Auto Import, then no download issues occur. When you do like this, no "FAILED DOWNLOADS" messages appear.

View solution in original post

3 REPLIES 3

avatar
Super Collaborator

Hi @Fernando Lopez Bello,

I did come across the same situation, by making the following changes I am able to connect through proxy.

63457-sbt.png

first location :

Under Settings --> system Settings --> HTTP proxy and provide your proxy details

second location :

under Build,Execution,Deployment --> Build Tools --> SBT under the JVM section in VM Parameters provide the proxy details

-Dhttp.proxyHost=***
-Dhttp.proxyPort=***
-Dhttp.proxyUser=***
-Dhttp.proxyPassword=***
-Dhttps.proxyHost=***
-Dhttps.proxyPort=***
-Dhttps.proxyUser=***
-Dhttps.proxyPassword=***

once done don't forget to restart the IDE, then it should connect to the external wold/proxy.

avatar
Expert Contributor

A couple of considerations that solved this issue: if you use SBT 0.13.16 (not newer that that) and set Use Auto Import, then no download issues occur. When you do like this, no "FAILED DOWNLOADS" messages appear.

avatar
Expert Contributor

For me, proxy settings (no matter if they were set at Intellij, SBT.conf or environment variables), did not work. A couple of considerations that solved this issue (for me at least):

- if you use SBT 0.13.16 (not newer that that)
- set Use Auto Import

Then, no "FAILED DOWNLOADS" messages appear.