Why is sbt trying to download non-existing dependencies? - scala

I've downloaded SBT 0.3.15 and I'm trying to run it : for now, I just want to run SBT and get the prompt ; I am not at the stage where I want to build a project yet (even though I expect to be able to do it very soon).
However, I face issues with strange dependencies that SBT tries to download. I initially faced issue with the proxy, but it's better now. The first thing that SBT tries to download is pom.xml for jansi-project 1.11 and it works :
downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom ...
Maven Central: downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
to C:\Users\vfuchs070114\.ivy2\cache\org.fusesource.jansi\jansi\ivy-1.11.xml.original.part
sha1 file found for https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom: checking...
Maven Central: downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom.sha1
to C:\Users\VFUCHS~1\AppData\Local\Temp\ivytmp1821470066062959950sha1
sha1 OK for https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
[SUCCESSFUL ] org.fusesource.jansi#jansi;1.11!jansi.pom(pom.original) (1085ms)
The next file it tries to download is fusesource-pom-1.8.jar from Maven central repo :
HTTP response status: 404 url=https://repo1.maven.org/maven2/org/fusesource/fusesource-pom/1.8/fusesource-pom-1.8.jar
CLIENT ERROR: Not Found url=https://repo1.maven.org/maven2/org/fusesource/fusesource-pom/1.8/fusesource-pom-1.8.jar
And here are a couple more :
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource/fusesource-pom/1.8/jars/fusesource-pom.jar
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource/fusesource-pom/1.8/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource/fusesource-pom/1.8/ivys/ivy.xml
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi-project/1.11/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource.jansi/jansi-project/1.11/ivys/ivy.xml
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
Then it fails... Since even through my browser I don't see anything available on these URLs, I'm ruling out a proxy config issue.
how am I supposed to get these dependencies, and from where ?
Thanks

After days of struggle, I don't have the exact answer to my question, but I've been able to find a workaround.
downloading dependencies through the corporate proxy just doesn't work and I don't know why. I configure SBT with same properties that I configure git : I'm able to clone GitHub projects, but SBT isn't able to get the dependencies. There's not enough specific infos in SBT logs to investigate anything, so I gave up this option.
we have Nexus as internal artifactory and proxy for external repositories. I asked the team in charge of it to create a new repository on our Nexus, mirroring https://dl.bintray.com/typesafe/ivy-releases/ , and then added the internal repositories URL in my config, as suggested here : http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html
maven-internal-thirdparty-proxy: internal_proxy_url, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
ivy-internal-typesafe-proxy: internal_proxy_url, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
I had to remove the internet proxy config I had put initially, to make sure SBT doesn't try to go through internet proxy to reach the internal proxy repos.

Related

Publishing / Resolving Custom SBT Plugins with Nexus

I've created my first SBT (1.x) AutoPlugin to add some settings and behavior to projects that use the plugin.
When I publish it locally, everything resolves and works correctly for the projects using the plugin.
However, when I publish the plugin to our private Nexus repository, it fails to resolve for any projects attempting to use it.
I realize that when sbt plugins are published locally, the path is different than 'regular' sbt projects, but they still resolve correctly for projects which use them.
Do I need to publish sbt plugins to a different location within Nexus than our other Scala / SBT-based projects?
And / or, do I need to set up a new resolver for Nexus-hosted SBT plugins?
I know similar questions have been asked previously, but being new to both Nexus and plugin creation, I haven't been able to figure out exactly what I need to do to get the plugin to resolve correctly when publishing to Nexus rather than simply doing a publishLocal and then adding it to the plugins.sbt file of projects meant to use the plugin.
Any assistance would be very much appreciated!

Maven - Artifcat Descriptor Exception - Local Repository and Online Conflict

So, I have a bit of a problem and being a bit new to Maven am not sure how to procede.
I have a Maven Project with a bunch of dependencies. Most of them are the typical stuff like Jackson, Mongo, Junit, etc. However, I also have dependencies on some local requirements that I have.
In eclipse I went File->Import->Install Or Deploay an Artifact to a Maven Repo
I point to the proper artifact and it's coresponding pom file and all is well. the pom.xml file doesn't throw any errors and all is good. However, if I go to the overview or look at the code in general it's not picking up these libraries.
I went and verified in my .m2\repository folder and all the libraries are there. I used 7zip and the code is in the jars as I'd except.
So, I thought - I'll try to do a Maven Update and have it be done in Offline mode to tell it to look at the local repos. Well, if I do that - the following error occurs:
UnresolvableModelException: Cannot access central (http://repo.maven.apache.org/maven2) in offline mode and the artifact has not been downloaded from it before.
If I then go back and try to do a regular update I get the following
ArtifactDescriptorException: Failed to read artifact descriptor for XXXX:YYYY which is my local repository stuff.
Seems I lose either one or the other.
Any help would be great!
Try to run Maven in debug mode with -X option :
mvn install -X
You should see more information :
[DEBUG] Reading global settings from D:\tools\apache-maven-3.2.1\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\jrrevy\.m2\settings.xml
[DEBUG] Using local repository at D:\tools\apache-maven-3.0.5\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\tools\apache-maven-3.0.5\.m2\repository
$M2_HOME or localrepository could be wrong due to settings.xml not configured or overriden by another one. This often happen, even to me.

How to force Maven only go to local repository to look for dependencies?

I am taking over a maven project from my former colleage's hand. Even there is a nexus configed in the settings.xml, but the url is already invalid. Now all the dependencies that this project needs are in the local repository on my hard drive(I went check and there are).
The problem is pom.xml still says miss some artifacts or dependencies, and everytime I run maven command try to clean or update or re-compile or re-build, maven went to that nexus url to download dependencies and fail...
This cost me a whole day and drove me crazy. Why does't maven just go to local repository to look for dependencies??? There are all in there!!
You can try to work offline via:
mvn --offline ...
But i would expect that there is something else wrong.

Can not download dependencies for SBT (the build tool for Scala) in the first run

As you must known, the first time you run SBT, it starts to download his dependencies:
>sbt sbt-version
Getting org.scala-sbt sbt 0.12.4
downloading repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.12.4/jars/main.jar ...
The problem is that I'm living in Africa and the ISP is not very good: for some unknown reason, they are some domains from which I can not download any file. For example, if I enter to the site of WAMP and try to download the installer, the download begins but it never ends. Normally I fix this issue by using a proxy (such as HideMyAss or ZendProxy), which servers as an intermediate between the site and the ISP, allowing me of download the file.
typesafe.com seems to be one of the not-work-for-download-in-africa domains, as consequence, SBT can not download his dependencies.
The question is, there is a way of download manually the dependencies? (I have downloaded them using a proxy, but I do not known in which folder put them in order to avoid SBT to try to download them)?
Create a directory in the root of your sbt project called lib and put the jars there.

How to proxy a static snapshot of scala 2.10.3

Scala 2.10.3 has a bug fix my team needs; but, I don't want to subject my group to a constantly changing version (using 2.10.3-SNAPSHOT). How can I download the latest snapshot, publish it to my local nexus (say 2.10.3-FOO) and have sbt use it? I'm familiar with proxy-ing and did get sbt to use our nexus repository to download the renamed scala-lang, scala-compiler. However, it never downloads scala-reflect and bombs out. What am I missing?
I found that pulling down scala.git and publishing a local build to our nexus repo using the ant tasks provided allowed me to accomplish what I was after. In terms of sbt, the documented way of using a proxy repo (-Dsbt.override.build.repos=true, using the repositories file) worked well.