Why is SBT unable to resolve my dependency?
ivy, maven, sbt
Solution
As I explained in the ticket you opened, what's happening is that Ivy is finding the `pom.xml` file in a particular resolver (in this case maven-central) but is unable to find the jar file there. This leads ivy to give up completely on resolution rather than just marking that resolver as bad and moving on.
What you need to do is ensure that the "good" resolvers you want are ordered before your "bad" resolvers. You can see the ordered list of resovlers sbt is going to use via the `show fullResolvers` command. Here's an example:
> show fullResolvers
[info] ArrayBuffer(Raw(ProjectResolver(inter-project, mapped: )), URLRepository(typesafe-ivy-releases,Patterns(ivyPatterns=List(http://repo.typesafe.com/typesafe/ivy-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(http://repo.typesafe.com/typesafe/ivy-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), URLRepository(sbt-plugin-releases,Patterns(ivyPatterns=List(http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), public: http://repo1.maven.org/maven2/)
Unfortunately, this output is just unreadable for humans right now. (Please open a ticket for the `export` command to support `fullResolvers`, and I can improve the debugging in the future). However, we can do some poor man's debugging, add this to `build.sbt`:
val exportFullResolvers = taskKey[Unit]("debug resolvers")
exportFullResolvers := {
for {
(resolver,idx) <- fullResolvers.value.zipWithIndex
} println(s"${idx}. ${resolver.name}")
}
Now, you can run this task inside your sbt build to figure out/toy with resolver orderings:
> exportFullResolvers
0. inter-project
1. typesafe-ivy-releases
2. sbt-plugin-releases
3. local
4. public
[success] Total time: 0 s, completed Feb 26, 2014 6:10:07 PM
You'll want to modify the resolvers such that inter-project comes first, but "public" (maven central) comes after the jboss resolver. You can modify the resovlers inline in build.sbt via:
fullResolvers := {
val previous = fullResolvers.value
previous.sortWith { (lhs, rhs) => ??? /* You define something here */ }
}
Problem
I need to use JMS 1.1 which Maven Central has deleted the jar for, for some reason. I added the JBoss repository to my list of repositories: ``` resolvers += "JBoss" at "https://repository.jboss.org/nexus/content/groups/public" ``` , but I'm getting the following error when I try to build using 0.13.1: ``` 25-Feb-2014 19:22:41 [warn] [NOT FOUND ] javax.jms#jms;1.1!jms.jar (0ms) 25-Feb-2014 19:22:41 [warn] ==== public: tried 25-Feb-2014 19:22:41 [warn] http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.jar 25-Feb-2014 19:22:41 [warn] :::::::::::::::::::::::::::::::::::::::::::::: 25-Feb-2014 19:22:41 [warn] :: FAILED DOWNLOADS :: 25-Feb-2014 19:22:41 [warn] :: ^ see resolution messages for details ^ :: 25-Feb-2014 19:22:41 [warn] :::::::::::::::::::::::::::::::::::::::::::::: 25-Feb-2014 19:22:41 [warn] :: javax.jms#jms;1.1!jms.jar 25-Feb-2014 19:22:41 [warn] :::::::::::::::::::::::::::::::::::::::::::::: 25-Feb-2014 19:22:41 [info] Wrote /appdata/liquidnet/data/BambooAgent/build-dir/TICKDB-SP-JOB1/src/target/scala-2.10/pretrade-scala_2.10-1.0.pom 25-Feb-2014 19:22:41 sbt.ResolveException: download failed: javax.jms#jms;1.1!jms.jar ``` I saw something about setting externalResolvers so it doesn't use Maven central, but I'd actually like to use Maven central for all the other dependencies that I have. I see the following when I issue `last *:update` ``` [info] Resolving javax.jms#jms;1.1 ... [debug] sbt-chain: Checking cache for: dependency: javax.jms#jms;1.1 {compile=[default(compile)]} [debug] tried /home/dnugent/.ivy2/local/javax.jms/jms/1.1/ivys/ivy.xml [debug] local: no ivy file found for javax.jms#jms;1.1 [debug] tried http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom [debug] public: found md file for javax.jms#jms;1.1 [debug] => http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom (1.1) [debug] downloading http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom ... [debug] public: downloading http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom [debug] public: downloading http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom.sha1 [debug] sha1 OK for http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.pom [debug] [SUCCESSFUL ] javax.jms#jms;1.1!jms.pom(pom.original) (121ms) [debug] tried /home/dnugent/.ivy2/local/javax.jms/jms/1.1/jars/jms.jar [debug] tried http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.jar [debug] CLIENT ERROR: Not Found url=http://repo1.maven.org/maven2/javax/jms/jms/1.1/jms-1.1.jar [debug] tried https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar [debug] found javax.jms#jms;1.1 in public ``` The JMS 1.1 Jar is definitely in the JBoss repo, so I'm really confused about what's going on here.