sbt排除源目录

thl*_*lim 12 scala sbt

如何配置build.sbt以排除src/main/java目录?我想把我的Java源代码放在那里,但我不想编译它们.此外,我可以排除使用RE指定的文件或文件组.这些可以在build.sbt中轻松配置吗?

Mar*_*rah 8

javaSource并且scalaSource是输入unmanagedSourceDirectories.然后您可以设置unmanagedSourceDirectoriesscalaSource:

unmanagedSourceDirectories in Compile <<=
   scalaSource in Compile apply ( (s: File) => s :: Nil)
Run Code Online (Sandbox Code Playgroud)

或者更短一些:

unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)( _ :: Nil)
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅类路径,源和资源.此外,inspect命令对于确定如何从其他设置构建设置非常有用.