Trying to understand how to set up SBT subprojects. What is the correct way to set default dependencies for all my sub projects?
I tried this, but my sub projects weren't picking up any of the dependencies (they downloaded fine).
import sbt._
class MyProjects(info: ProjectInfo) extends DefaultProject(info)
{
val projA = project("projA", "ProjectA")
val projB = project("projB", "ProjectB")
val akkaRepo = "Akka maven2 repo" at "http://www.scalablesolutions.se/akka/repository/"
val multiverseRepo = "Multiverse maven2 repo" at "http://multiverse.googlecode.com/svn/maven-repository/releases/"
val guiceyFruitRepo = "GuiceyFruit Maven2 repo" at "http://guiceyfruit.googlecode.com/svn/repo/releases/"
val jBossRepo = "JBoss maven2 repo" at "https://repository.jboss.org/nexus/content/groups/public/"
val junit = "junit" % "junit" % "4.5" % "test"
val scalatest = "org.scalatest" % "scalatest" % "1.2" % "test"
val akka = "se.scalablesolutions.akka" % "akka-core_2.8.0" % "0.10"
}
Then, based on this I tried the following. It worked, but it's not what I was expecting to have to do. Isn't there a simpler was to set default dependencies for all subprojects?
import sbt._
class MyProjects(info: ProjectInfo) extends DefaultProject(info)
{
val projA = project("projA", "ProjectA", new Proj(_))
val projB = project("projB", "ProjectB", new Proj(_))
val akkaRepo = "Akka maven2 repo" at "http://www.scalablesolutions.se/akka/repository/"
val multiversRepo = "Multiverse maven2 repo" at "http://multiverse.googlecode.com/svn/maven-repository/releases/"
val guiceyFruitRepo = "GuiceyFruit Maven2 repo" at "http://guiceyfruit.googlecode.com/svn/repo/releases/"
val jBossRepo = "JBoss maven2 repo" at "https://repository.jboss.org/nexus/content/groups/public/"
class Proj(info:ProjectInfo) extends DefaultProject(info){
val junit = "junit" % "junit" % "4.5" % "test"
val scalatest = "org.scalatest" % "scalatest" % "1.2" % "test"
val akka = "se.scalablesolutions.akka" % "akka-core_2.8.0" % "0.10"
}
}
Edit: Should point out there is an better way to use Akka, but was just illustrating my point.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…