我知道我可以在javadoc中使用IMG
标签。但是图像文件放在哪里呢?如果我将它们与 java 文件放在一起,它们将在编译过程中转到 JAR
文件或 class
文件夹,这不是必需的。
如何获得只与javadoc相关而不与代码资源相关的图像文件?
最佳答案
如 Javadoc tool documentation 中所述,在“其他未处理的文件”部分:
To include unprocessed files, put them in a directory called doc-files which can be a subdirectory of any package directory that contains source files. You can have one such subdirectory for each package. You might include images, example code, source files, .class files, applets and HTML files. For example, if you want to include the image of a button button.gif in the java.awt.Button class documentation, you place that file in the /home/user/src/java/awt/doc-files/ directory. Notice the doc-files directory should not be located at /home/user/src/java/doc-files because java is not a package -- that is, it does not directly contain any source files.
这意味着图像文件必须作为源目录结构的一部分提供。这意味着您的构建过程应该设计为避免将这些文件复制到类目录结构中。原始 javac 工具不会执行复制,您必须配置 IDE 或构建脚本(maven、ant、gradle 等)以在编译或 jar 步骤中排除这些文件。
关于java - Javadoc 的图像文件放在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26084777/