问题描述
如何配置 build.sbt 以排除 src/main/java 目录?我想把我的 Java 源代码放在那里,但我不想编译它们.另外,我可以排除用 RE 指定的一个文件或一组文件吗?这些可以在 build.sbt 中轻松配置吗?
How do I config build.sbt to exclude src/main/java directory? I would like to put my Java sources there but I don't want to compile them. Also, can I exclude a file or group of files specify with RE. Can these be easily configured in build.sbt?
推荐答案
javaSource
和 scalaSource
是 unmanagedSourceDirectories
的输入.然后您可以将 unmanagedSourceDirectories
设置为 scalaSource
only:
javaSource
and scalaSource
are inputs to unmanagedSourceDirectories
. You can then set unmanagedSourceDirectories
to be scalaSource
only:
unmanagedSourceDirectories in Compile <<=
scalaSource in Compile apply ( (s: File) => s :: Nil)
或更短一点:
unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)( _ :: Nil)
有关详细信息,请参阅类路径、来源和资源.此外,inspect 命令对于确定设置的构建方式很有用来自其他设置.
See Classpaths, sources, and resources for details. Also, the inspect command is useful for determining how settings are built up from other settings.
这篇关于sbt 排除源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!