我看到这个代码用于向SBT项目添加配置文件,但它在Scala 2.9.2中不能为我编译。
val ProfileDev = config("dev") extend(Runtime)
val ProfileQA = config("qa") extend(Runtime)
val root = (project in file(".")).
configs(ProfileDev, ProfileQA). // add config here!
settings(
name := "helloworld",
....
).
settings(inConfig(ProfileDev)(Classpaths.configSettings ++ Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / configuration.value.name / "resources"}
)): _*).
settings(inConfig(ProfileQA)(Classpaths.configSettings ++ Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / configuration.value.name / "resources"}
)): _*)
这是我面临的错误
Compiling 1 Scala source to /home/robin/workspace/active_projects/Republiq/server/project/target/scala-2.9.2/sbt-0.12/classes...
[error] /home/robin/workspace/active_projects/Republiq/server/project/Build.scala:121: value value is not a member of sbt.SettingKey[java.io.File]
[error] unmanagedResourceDirectories += {baseDirectory.value / "src" / configuration.value.name / "resources"}
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
答案 0 :(得分:5)
我猜(从编译路径Republiq/server/project/target/scala-2.9.2/sbt-0.12/classes
)您使用SBT 0.12 。
仅在 0.13 时才引入对宏value
的支持 - 请参阅 0.13.0更改文档中的New task/setting syntax。
升级至SBT 0.13或使用value
重写零件。