下面是我的build.sbt中使用的代码,用于添加其他测试源目录,并且工作正常: -
unmanagedSourceDirectories in Test ++= Seq ( (baseDirectory( _ / "abc" )).value, (baseDirectory( _ / "xyz" )).value )
但是,以下版本提供非法动态错误
val folderList = Seq("abc", "xyz")
unmanagedSourceDirectories in Test ++= folderList map { src => (baseDirectory( _ / src )).value }
根据建议here,我尝试了动态任务也没有运气: -
val folderList = Seq("abc", "xyz")
val dynamic = Def.taskDyn{
Def.task{
folderList
}
}
unmanagedSourceDirectories in Test ++= dynamic.value map { src => (baseDirectory( _ / src )).value }
请建议正确的语法。
答案 0 :(得分:0)
您不需要为此用例定义动态任务。只需使用.value
宏:
val folderList = Seq("abc", "xyz")
unmanagedSourceDirectories in Test ++=
folderList.map { src => (baseDirectory in Test).value / src }