如何在doc任务中排除java源文件?

发布于 2024-12-27 10:46:04 字数 435 浏览 6 评论 0原文

我正在将 sbt 0.11.2 用于混合 Java/Scala 项目。我意识到,当我从 sbt 中运行 doc 命令时,它不仅会在 src/main/scala 中为 Scala 源文件创建 scaladocs,而且还会为对于 src/main/java 中的 Java 源文件(sbt wiki 声称为 src/main/scala 创建它们,但这似乎不正确)。

然而,这看起来不太好。例如,对于具有静态方法的名为 Foo 的 Java 类,生成的 scaladoc 中有两个条目:一个 Foo 类和一个 Foo 对象。类仅列出构造函数,而对象列出静态方法。

有什么方法可以告诉 sbt 从 scaladoc 生成中排除 src/main/java 文件夹吗?我想为这些创建 javadoc。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀里藏娇 2025-01-03 10:46:04

处理此问题的常用方法是使用 inspect 查看信息的来源,然后进行更改。检查 doc 显示 compile:sources(for doc),它是一个 Seq[java.io.File],并且可以像这样进行更改this:

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

您可以使用 showcompile:sources(for doc) 查看它包含的内容,然后 set 更改它并再次检查它的值。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文