在我有这样的东西(简化)之前,使用 sbt 0.11.3:
// project/Build.scala
import sbt._
import Keys._
object MyBuild extends Build {
lazy val standardSettings = Defaults.defaultSettings ++ Seq(
version := "0.2",
scalaVersion := "2.9.2"
)
lazy val main = Project(
id = "main",
base = file( "." ),
settings = standardSettings,
aggregate = Seq( sub )
)
lazy val sub = Project(
id = "main-sub",
base = file( "sub" ),
settings = standardSettings
)
}
build.sbt
但我想在纯文件中保留尽可能多的信息。所以现在我有
// build.sbt
version := "0.2"
scalaVersion := "2.9.2"
和
// project/Build.scala
import sbt._
import Keys._
object MyBuild extends Build {
lazy val main = Project(
id = "main",
base = file( "." ),
aggregate = Seq( sub )
)
lazy val sub = Project(
id = "main-sub",
base = file( "sub" )
)
}
但这似乎并没有将我的设置build.sbt
混入子项目中:
> show version
[info] main-sub/*:version
[info] 0.1-SNAPSHOT
[info] main/*:version
[info] 0.2
> show scala-version
[info] main-sub/*:scala-version
[info] 2.9.1
[info] main/*:scala-version
[info] 2.9.2
如何解决这个问题?我还尝试向settings
子项目添加显式,例如
settings = Defaults.defaultSettings
settings = Project.defaultSettings
settings = MyBuild.settings
settings = main.settings
(确定这个应该做吗?!)
...但没有一个工作。