我成功配置了SBT以查找其默认目录结构之外的源。
val absoluteDir = "/home/.../[fooProjectBaseDirectory]/"
unmanagedSourceDirectories in Compile += new File(absoluteDir + "jvm/src")
unmanagedSourceDirectories in Test += new File(absoluteDir + "jvm/test/src")
在现实世界中,我想通过使用相对目录来实现相同目的。
我尝试过:
sourceDirectory in Compile := baseDirectory.value / "jvm" / "src"
sourceDirectory in Test := baseDirectory.value / "jvm" / "test" / "src"
但是sbt似乎将 scala-2.12 , scala 或 java 目录附加到了我的路径,导致搜索失败。>
sbt:foo> 检查编译:unmanagedSourceDirectories [信息] 设置:scala.collection.Seq [java.io.File] = 列表(/ home /.../ [fooProjectBaseDirectory] / jvm / src / scala-2.12 , / home /.../ [fooProjectBaseDirectory] / jvm / src / scala , / home /.../ [fooProjectBaseDirectory] / jvm / src / java )
有任何提示吗?
答案 0 :(得分:0)
找到了解决方案。两者都在工作:
unmanagedSourceDirectories in Compile += baseDirectory.value / "jvm" / "src"
unmanagedSourceDirectories in Test += baseDirectory.value / "jvm" / "test" / "src"
或
Compile / unmanagedSourceDirectories += baseDirectory.value / "jvm" / "src"
Test / unmanagedSourceDirectories += baseDirectory.value / "jvm" / "test" / "src"