为什么SBT只编译最后一个子项目?

时间:2013-01-02 18:42:20

标签: scala sbt

我疯了,真的: - (

给出以下SBT构建文件......

import sbt._
import sbt.Keys._

object BrixBuild extends Build {

  lazy val buildSettings = Project.defaultSettings ++ Seq(
    organization := "com.mycompany",
    version := "0.1-SNAPSHOT",
    scalaVersion := "2.10.0-RC3",
    scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-deprecation", "-feature", "-unchecked"),
    resolvers += Resolvers.typesafe,
    target := file("target")
  )

  lazy val util = Project(
    id = "brix-util",
    base = file("brix-util"),
    settings = buildSettings ++ Seq(
      libraryDependencies ++= Dependencies.util
    )
  )

  lazy val slick = Project(
    id = "brix-slick",
    base = file("brix-slick"),
    settings = buildSettings ++ Seq(
      libraryDependencies ++= Dependencies.slick
    )
  )
}

object Resolvers {

  val typesafe = "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases"
}

object Dependencies {

  private object Compile {
    val commonsCodec = "commons-codec" % "commons-codec" % "1.7"
    val slick = "com.typesafe" %% "slick" % "1.0.0-RC1"
  }

  private object Test {
    val specs2 = "org.specs2" %% "specs2" % "1.12.3" % "test"
    val slf4j = "org.slf4j" % "slf4j-nop" % "1.6.4" % "test"
    val h2 = "com.h2database" % "h2" % "1.3.166" % "test"
  }

  val util = Seq(Compile.commonsCodec, Test.specs2, Test.slf4j)
  val slick = Seq(Compile.slick, Test.specs2, Test.slf4j, Test.h2)
}

...只编译最后一个子项目。为什么?我错过了什么吗?

任何帮助都会非常感激。 TX。

1 个答案:

答案 0 :(得分:3)

您应该定义聚合子项目的“父”项目。有关示例,请参阅https://github.com/typesafehub/scalalogging/blob/master/project/Build.scala