除了Typesafe之外,SBT不会解决对任何存储库的传递依赖性

时间:2013-03-24 00:29:32

标签: scala maven sbt

我有一种传递性的依赖,只是无法解决,我正在撕裂我的头发。

特定的依赖关系是org.apache.maven.wagon#wagon-provider-api;1.0-beta-2!wagon-provider-api.jar,但我不确定哪个直接依赖包含它。

该文件在默认的Maven仓库中运行良好。然而,出于某种原因,SBT只是拒绝检查它,尽管它很乐意在那里查找其他依赖项:

[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

我已从主目录中删除了.ivy2.m2.sbt。我跑了sbt update。我一遍又一遍地运行play cleanplay clean-all。从SBT提示符运行resolvers显示Maven仓库在列表中。

我已经尝试下载jar并将其添加到我的常春藤缓存,我的Ivy存储库,我的Play!库中。

还有什么可以尝试?

我的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/")
  )

}

3 个答案:

答案 0 :(得分:1)

尝试

resolvers := // which overrides current resolvers

而不是

resolvers ++= // which appends to current resolvers

不要问我解释,因为我不知道为什么会这样。刚刚与JUnit有类似的问题,this link建议这样做,这有助于......

答案 1 :(得分:0)

而不是:

resolvers :=  

(这有不允许多个解析器的缺点。)我找到了

resolvers += 

工作正常,并没有表现出来自OP的错误。

答案 2 :(得分:0)

我有类似的问题。但SBT甚至会在maven回购中搜索它所说的不起作用的链接,实际上是有效的。

我通过在默认播放stuf:

之前移动我自己的依赖项来解决它

之前

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    
  )

希望这有助于其他人。干杯