Ryan
Ryan

Reputation: 7247

SBT won't resolve transitive dependency against any repository except Typesafe's

I have a transitive dependency that just won't resolve and I'm tearing my hair out over this.

The specific dependency is org.apache.maven.wagon#wagon-provider-api;1.0-beta-2!wagon-provider-api.jar though I'm not sure which direct dependency is including it.

The file is alive and well on the default Maven repo. For some reason, however, SBT just refuses to check there for it though it's happy to look there for other dependencies:

[warn]  [NOT FOUND  ] org.apache.maven.wagon#wagon-provider-api;1.0-beta-2!wagon-provider-api.jar (52ms)
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.apache.maven.wagon#wagon-provider-api;1.0-beta-2!wagon-provider-api.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] (*:update) sbt.ResolveException: download failed: org.apache.maven.wagon#wagon-provider-api;1.0-beta-2!wagon-provider-api.jar
[error] Total time: 3 s, completed Mar 23, 2013 7:22:05 PM

I've deleted .ivy2, .m2 and .sbt from my home directory. I've run sbt update. I've run play clean and play clean-all over and over. Runnings resolvers from the SBT prompt shows the Maven repo is in the list.

I've tried downloading the jar and adding it to my Ivy cache, my Ivy repository, my Play! repository.

What's left to try?

My Build.scala:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "conspire"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    "mysql" % "mysql-connector-java" % "5.1.18",
    "org.apache.cayenne.plugins" % "maven-cayenne-plugin" % "3.0.2",
    "org.objectstyle.ashwood" % "ashwood" % "2.0",
    "commons-collections" % "commons-collections" % "3.1",
    "commons-lang" % "commons-lang" % "2.6",
    "commons-logging" % "commons-logging" % "1.1"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    externalResolvers += "Local Maven Repository" at "file:///"+Path.userHome+"/.m2/repository",
    resolvers ++= Seq(DefaultMavenRepository,
                      "Objectstyle repository" at " http://objectstyle.org/maven2/")
  )

}

Upvotes: 3

Views: 4684

Answers (3)

agilesteel
agilesteel

Reputation: 16859

Try

resolvers := // which overrides current resolvers

instead of

resolvers ++= // which appends to current resolvers

Don't ask me for explanation though, cause I have no idea why it works. Just had a similar issue with JUnit and this link suggested doing it so, which helped...

Upvotes: 1

Andi
Andi

Reputation: 541

I had a similar problem. But SBT would even search in the maven repo and the link it said does not work, actually works.

I solved it by moving my own dependencies before the default play stuf:

BEFORE

val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    "mysql" % "mysql-connector-java" % "5.1.32"
  )

AFTER

val appDependencies = Seq(
    "mysql" % "mysql-connector-java" % "5.1.32",
    javaCore,
    javaJdbc    
  )

Hope this helps someone else. Cheers

Upvotes: 0

WestCoastProjects
WestCoastProjects

Reputation: 63162

Instead of :

resolvers :=  

(which has the downside of not permitting multiple resolvers.) I have found that

resolvers += 

works fine, and does not exhibit the bug from the OP.

Upvotes: 0

Related Questions