How to exclude java source files in doc task?

假装没事ソ 提交于 2019-12-04 17:17:34

问题


I'm using sbt 0.11.2 for a mixed Java/Scala project. I've realized that when I run the doc command from within sbt, it does not only create the scaladocs for the Scala source files in src/main/scala, but also for the Java source files in src/main/java (the sbt wiki claims to create them for src/main/scala only that seems not true).

However, this does not look very well. For instance, for a Java class named Foo with static methods there are two entries in the generated scaladoc: a Foo class and a Foo object. The class only lists the constructor and the object lists the static methods.

Is there any way I can tell sbt to exclude the src/main/java folder from the scaladoc generation? I want to create javadocs for those instead.


回答1:


The usual way to handle that is to use inspect to see where the information is coming from, and then change it. Inspecting at doc shows compile:sources(for doc), which is a Seq[java.io.File], and can be changed like this:

sources in (Compile, doc) ~= (_ filter (_.getName endsWith ".scala"))

You can use show compile:sources(for doc) to see what it contains, and then set to change it and check again its value.



来源:https://stackoverflow.com/questions/8884866/how-to-exclude-java-source-files-in-doc-task

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