sbt to exclude source directory

允我心安 提交于 2020-01-01 08:20:55

问题


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?


回答1:


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)

or a bit shorter:

unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)( _ :: Nil)

See Classpaths, sources, and resources for details. Also, the inspect command is useful for determining how settings are built up from other settings.




回答2:


Well, there might be a better way but I'd add this to my build.sbt:

javaSource in Compile := file("some/path/that/doesnt/exist")



来源:https://stackoverflow.com/questions/7371802/sbt-to-exclude-source-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!