2014-01-18 42 views
5

在多模塊項目中,構建模塊時,SBT似乎沒有使用resolvers。解析器在根項目的build.sbt聲明如下:爲什麼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] :::::::::::::::::::::::::::::::::::::::::::::: 

任何想法可能是錯誤的?

回答

7

使用在根項目的build.sbt如下:

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

in ThisBuild就是答案。見Scopes

+0

感謝,這個固定的問題 –

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)

相關問題