为什么SBT不使用根项目中的解析器(在多模块项目中)

时间:2014-01-18 23:53:26

标签: sbt

在多模块项目中,SBT在构建模块时似乎不使用resolvers。解析器在根项目的build.sbt中声明如下:

resolvers += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

并且项目声明如下:

lazy val core = project.settings(
    libraryDependencies ++= { ... }
)

但是在编译时,没有使用旋转变压器,我得到了:

[info] Resolving org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT ...
[warn]  module not found: org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT
[warn] ==== local: tried
[warn]   /home/ariskk/.ivy2/local/org.springframework.scala/spring-scala/1.0.0.BUILD-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/springframework/scala/spring-scala/1.0.0.BUILD-SNAPSHOT/spring-scala-1.0.0.BUILD-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

任何想法可能出错?

2 个答案:

答案 0 :(得分:10)

在根项目的build.sbt中使用以下内容:

resolvers in ThisBuild += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

in ThisBuild就是答案。请参阅Scopes

答案 1 :(得分:0)

我在Scala / ScalaJS项目中遇到了类似的问题。

只有在添加到'子项目中时才会使用解析器。

//this works NOT
resolvers += Resolver.sonatypeRepo("snapshots")

// this works
lazy val client = (project in file("client")).settings(
   scalaVersion := scalaV,
   ...,
   resolvers += Resolver.sonatypeRepo("snapshots"),
   ...

(sbt 0.13.15)