我正在使用 sbt 交叉构建我的项目支持两个 scala 版本scala-2.12.8
,scala-2.13.1
并且我有源代码目录作为
src/main/scala_2.12
src/main/test_2.12
src/main/scala_2.13
src/main/test_2.13
我查看了 sbt文档,其中并不清楚,然后我发现这个答案 是我的代码
unmanagedSourceDirectories in Compile <+= (scalaVersion, sourceDirectory in Compile) {
case (v, dir) if v startsWith "2.12" => dir / "scala_2.12"
case (v, dir) if v startsWith "2.13" => dir / "scala"
}
并收到以下错误
info] Loading project definition from /home/git/testproj/project
/home/git/testproj/build.sbt:54: error: (sbt.SettingKey[String], sbt.SettingKey[java.io.File]) does not take parameters
unmanagedSourceDirectories in Compile <+= (scalaVersion, sourceDirectory in Compile) {
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?