SBT can't resolve dependencies through proxy - scala

When I run sbt update i get this error
:: problems summary ::
:::: WARNINGS
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-sbt#sbt;0.13.8: several problems occurred while resolving dependency: org.scala-sbt#sbt;0.13.8 {default=[default(compile)]}:
java.util.NoSuchElementException
java.util.NoSuchElementException
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.8: several problems occurred while resolving dependency: org.scala-sbt#sbt;0.13.8 {default=[default(compile)]}:
java.util.NoSuchElementException
java.util.NoSuchElementException
Error during sbt execution: Error retrieving required libraries
(see /Users/$USER/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.8
I've already set up the system to work with curl and homebrew using a proxy, but for some reason sbt won't work with the same settings. When I turn the proxy off, It just hangs for a few minutes before timing out and I don't get the aforementioned error.
I've also tried this, but without any luck
# export JAVA_FLAGS= -Dhttp.proxyHost=$domain -Dhttp.proxyPort=$portnum -Dhttp.proxyUser=$USER -Dhttp.proxyPassword=$password -Dhttps.proxyHost=$domain -Dhttps.proxyPort=$portnum -Dhttps.proxyUser=$USER -Dhttps.proxyPassword=$password -Dftp.proxyHost=$domain -Dftp.proxyPort=$portnum -Dftp.proxyUser=$USER -Dftp.proxyPassword=$password -Dhttp.nonProxyHosts=$noproxy -Dhttps.nonProxyHosts=$noproxy -Dftp.nonProxyHosts=$noproxy
# java ${JAVA_FLAGS}
The method I used to make hombrew and curl work is
export http_proxy=$http_proxy
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
Any suggestions?
Thanks

I am not sure whether your JAVA_FLAGS included/exported to classpath or not, if not add it to classpath before trying this solution.
My Resoultion:
I don't know which IDE you are using, I faced same issue (I use IntelliJ 14). Try to relate to your IDE if you use different one, basically set it through VM arguments.
I have resolved this issue by adding vm arguments ...
Steps to add in IntelliJ:
File -> Default Settings -> under Build,Execution, Deployment
Build Tools -> SBT ->
JVM Options -> set in the "VM parameters" like this
-Dhttp.proxyHost=http://proxy.xxxx.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=http://proxy.xxx.com -Dhttps.proxyPort=8080 -XX:MaxPermSize=384M -Duser.home=/Users/yourusername/ -Dsbt.ivy.home=/Users/yourusername/.ivy2
Good Luck

Related

WARNINGS module not found: org.fusesource.jansi#jansi;1.11 - Intellij/Scala

So I installed Intellij along with the Scala plugin. When I try to create my first scala project in the IDE, the dialog box comes up where you specify the name and location of the project, as well as the locations of the necessary SDK's. I referenced Java's SDK easily, but nowhere can I find the Scala JDK - A search of my computer comes up empty. No matter - the dialog box in which I am to create a Scala SDK has an option to dowload it right there - but then it comes up with the following error when I try.
Getting org.fusesource.jansi jansi 1.11 ...
:: problems summary :: :::: WARNINGS
module not found: org.fusesource.jansi#jansi;1.11
:::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.fusesource.jansi#jansi;1.11: not found
::::::::::::::::::::::::::::::::::::::::::::::
:::: ERRORS
:: 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\Augustine\.sbt\boot\update.log for complete log) Error: Could not retrieve jansi 1.11 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Simply put, what can I do to avoid this error and get Scala working in IntelliJ? Thanks!
you might be getting problem of downloading dependencies runtime because of poor internet connection
you can manually download all dependencies xml and jar files.. and you can get all those files here
http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt
or instead of intellij IDE, go for scala IDE for eclipse... in eclipse we dont need to set sbt externally.

Configuring Intellij IDEA 15.0.4 and SBT 0.13.7 with local Artifactory server

I installed Intellij IDEA 15.0.4 + Scala plugin (2.2.0) on a computer with an internet connection, created a new SBT project and all the external dependencies were added to the project:
i.stack.imgur.com/v560H.png
However, when I try to do the same thing in our issolated network (no internet) against our Artifactory server, I got the following message:
Error:Error while importing SBT project:...
http://zzz:8081/artifactory/scala_local/org/fusesource/jansi/jansi/1.11/jansi-1.11.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.fusesource.jansi#jansi;1.11: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: 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....sbt\boot\update.log for complete log) Error: Could not
retrieve jansi 1.11See complete log in C:\Users....IdeaIC15\system\log\sbt.last.log
So I figured I need to get jansi 1.11 up to Artifactory (to /org/fusesource/jansi/jansi/1.11/).
After uploading jansi to Artifactory, I refreshed SBT and started getting the following message:
Error:Error while importing SBT project:Error during sbt execution: No
Scala version specified or detected
So I'm guessing it has something to do with the fact that Scala is not available in Artifactory? If that's the reason, it seems unreasonable to upload all the jars to their respective paths manually, and I couldn't "guess" the path in my many tries... So I'm pretty sure I'm doing something wrong here...
This is my build.sbt:
name := "untitled"
version := "1.0"
scalaVersion := "2.10.4"
This is my .sbt\repositories:
[repositories] local my-ivy-proxy-releases: http://zzz:8081/artifactory/scala_local/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] my-maven-proxy-releases: http://zzz:8081/artifactory/scala_local/
(sorry for the layout, won't let me post more than 2 links...)
I checked some similar issues here, nothing seemed to help...
I'd appreciate your help on what I should check / read on...
Is there a way to automatically deploy all the dependencies to the correct path in Artifactory?
***EDIT:
Ok, so I removed .sbt\repositories file, invalidated the IntelliJ cache and restarted, created a new SBT project...
This didn't seem to help, also
now it seems that it doesn't recognize the build.sbt syntax anymore...
Even when I add the resolver, it completely ignores it...
I manually deleted the directories in /.sbt/boot/other/ (had jansi and scala-sbt there), and now it can't resolve jansi again, only this time it tries to connect to repo1.maven.org... :
Error:Error while importing SBT project:<br/>...<br/><pre> https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.fusesource.jansi#jansi;1.11: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: 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\...\.sbt\boot\update.log for complete log)
Error: Could not retrieve jansi 1.11
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0</pre><br/>See complete log in C:\Users\...\.IdeaIC15\system\log\sbt.last.log
Thanks,
PA
We encounter a similar issue.
What finally solved the problem was removing .sbt\repository file.
Then all dependency could be resolved with the default repositories.
It is the problem of IDE you are using specially the scala plugin in it. You can get ride of this just go to the folder where the build.sbt is created. Delete the "project" folder and open cmd, run "sbt" command on the folder, a new project folder will be created. Now you can open that in IDE.
It may be that you may find some problem very first in ide, if you build the project once , all the problems will go away.

Install SBT on Linux

I am trying to install SBT for scala developing. I follow the guid in Installing sbt manually
The errors show as follows
:: problems summary ::
:::: WARNINGS
module not found: org.scala-sbt#sbt;0.13.7
==== local: tried
/home/nan/.ivy2/local/org.scala-sbt/sbt/0.13.7/ivys/ivy.xml
-- artifact org.scala-sbt#sbt;0.13.7!sbt.jar:
/home/nan/.ivy2/local/org.scala-sbt/sbt/0.13.7/jars/sbt.jar
==== typesafe-ivy-releases: tried
https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.7/ivys/ivy.xml
==== Maven Central: tried
https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.7/sbt-0.13.7.pom
-- artifact org.scala-sbt#sbt;0.13.7!sbt.jar:
https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.7/sbt-0.13.7.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-sbt#sbt;0.13.7: not found
::::::::::::::::::::::::::::::::::::::::::::
:::::: ERRORS
Server access Error: Connection refused url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.7/ivys/ivy.xml
Server access Error: Connection refused url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.7/sbt-0.13.7.pom
Server access Error: Connection refused url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.7/sbt-0.13.7.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.7: not found
Error during sbt execution: Error retrieving required libraries (see /home/nan/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.7
The link "https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.7/sbt-0.13.7.jar" cannot be accessed even in the browser. Are there any solutions?
As the commenter said, it looks like you are just having a network connection problem.
However, if you are not using a package manager, I recommend to use the "sbt-extras" script from here. I.e.
curl -s https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt \
> ~/bin/sbt && chmod 0755 ~/bin/sbt

How to use sbt behind authenticated proxy?

As given in other answers. I have properly set the value of http proxy host and port.
but it is giving the following error
Getting org.scala-sbt sbt 0.13.6 ...
You probably access the destination server through a proxy server that is not well configured.
You probably access the destination server through a proxy server that is not well configured.
You probably access the destination server through a proxy server that is not well configured.
:: problems summary ::
:::: WARNINGS
Host repo.typesafe.com not found. url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.6/ivys/ivy.xml
Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.6/sbt-0.13.6.pom
Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.6/sbt-0.13.6.jar
module not found: org.scala-sbt#sbt;0.13.6
==== local: tried
/home/vibhanshu/.ivy2/local/org.scala-sbt/sbt/0.13.6/ivys/ivy.xml
-- artifact org.scala-sbt#sbt;0.13.6!sbt.jar:
/home/vibhanshu/.ivy2/local/org.scala-sbt/sbt/0.13.6/jars/sbt.jar
==== typesafe-ivy-releases: tried
https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.6/ivys/ivy.xml
==== Maven Central: tried
https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.6/sbt-0.13.6.pom
-- artifact org.scala-sbt#sbt;0.13.6!sbt.jar:
https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.6/sbt-0.13.6.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-sbt#sbt;0.13.6: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.6: not found
Error during sbt execution: Error retrieving required libraries
(see /home/vibhanshu/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.6
I added the following line to .bashrc.
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=proxy -Dhttp.proxyPort=port -Dhttps.proxyHost=proxy -Dhttps.proxyPort=port"
It works fine.
If you are in behind the proxy(corporate network)
For windows :
In sbt installation folder, go to conf/sbtconfig.txt file just add the following lines and save and try.
-Dhttp.proxyHost=proxy
-Dhttp.proxyPort=portno
-Dhttp.proxyUser=UserId
-Dhttp.proxyPassword=Password
-Dhttps.proxyHost=proxyhost
-Dhttps.proxyPort=portno
-Dhttps.proxyUser=UserId
-Dhttps.proxyPassword=Password
For Linux/Unix:
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=proxyHost -Dhttp.proxyPort=proxyPortNumber -Dhttp.proxyUser=UserId -Dhttp.proxyPassword=Password -Dhttps.proxyHost=proxyHost -Dhttps.proxyPort=proxyPortNumber -Dhttps.proxyUser=UserId -Dhttps.proxyPassword=Password"
It worked for me too.
I was facing the same issue (behind corporate firewall and getting this error message) and I tried all the options from various related threads but none of them resolved the problem. I was able to finally get IntelliJ to work by configuring HTTP Proxy in IntelliJ itself. Here's what my configurations look like (Note: provide your network username and password in related boxes):-

Scala sbt unable to find commons-logging-1.0.4.jar

I am trying to get an open source project running with scala that is built using sbt.
I downloaded sbt and set it up. But when I try to run sbt from the command line, I get the following error.
:: problems summary :: :::: WARNINGS [NOT FOUND ]
commons-logging#commons-logging;1.0.4!commons-logging.jar (1ms)
==== Maven2 Local: tried
file:///Users/jeremy/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: FAILED DOWNLOADS ::
:: ^ see resolution messages for details ^ ::
::::::::::::::::::::::::::::::::::::::::::::::
:: commons-logging#commons-logging;1.0.4!commons-logging.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS download
failed: commons-logging#commons-logging;1.0.4!commons-logging.jar
Error during sbt execution: Error retrieving required libraries (see
/Users/jeremy/sourceCode/public/scalaConsole/project/boot/update.log
for complete log) Error: Could not retrieve sbt 0.10.1
Any ideas on how I could resolve this.
I have scala 2.9.1 and sbt version 0.10.1
Thanks
It worked for me after I removed both ~/.m2/repository/commons-logging and ~/.ivy2/cache/commons-logging. If sbt founds none of this two paths it will actually try and download the commons logging package.
Sometimes maven doesn't download the files correctly and you'll only find a .pom file in the repository and no commons-logging-1.0.4.jar file. First I removed ~/.m2/repository/commons-logging. Then I downloaded the jar manually from http://search.maven.org/remotecontent?filepath=commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar and finally installed the jar using the mvn install command:
mvn install:install-file -DgroupId=commons-logging -DartifactId=commons-logging -Dversion=1.0.4 -Dpackaging=jar -Dfile=commons-logging-1.0.4.jar
Are you behind a proxy server? If so you may need to modify your sbt bat or sh script to pass along the proxy information to the JVM like so:
java -XX:MaxPermSize=96m -Xmx512m -Dhttp.proxyHost=my.proxy.server.com -Dhttp.proxyPort=1234 -jar sbt-launch-0.10.1.jar
I don't know what the root cause of the issue is. But I use a script that automatically installs and launches sbt; so I modified the script to download commons-logging before running sbt.
The sbt launcher is here: https://gist.github.com/1274530
To run sbt, save the script somewhere in your $PATH, make sure that is executable, and run it by typing sbt.
Add http://repo1.maven.org/maven to the maven.repo.remote property in your project.properties file. This will download the file from the maven2 remote repository.
Old entry:
maven.repo.remote=http://www.ibiblio.org/maven
New entry:
maven.repo.remote=http://www.ibiblio.org/maven,http://repo1.maven.org/maven