Java API 文档
如何将 Java 文档添加到 .JAR 文件中,以便人们在使用我的 JAR 文件时键入“.” Eclipse 将显示可用 API(智能感知)的文档。
更多信息
我创建了 java 文档,但是当我导出 jar 文件时,在其他项目中使用时它不包含智能感知。这就是我遇到的麻烦。
更新 仅当导出源时才会显示智能感知。不过我想隐藏源代码。我该如何解决这个问题?
How can I add Java documentation to a .JAR file so that when people are using my JAR file and type '.' Eclipse will display the documentation for the available API's (intellisense).
MORE INFO
I have java doc created but when I export the jar file it does not contain intellisense when used in other projects. This is what I am having trouble with.
UPDATE
The intellisense only shows up if the export the source. However I want to hide the source code. How can I get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您不想在 .jar 中包含整个源代码,您可以只压缩/jar javadoc(但是您生成它们......我使用 Eclipse 中的 Project->Generate Javadoc 菜单选项来完成此操作)。然后,最终用户可以将它们“附加”到项目构建路径设置中引用的库。
项目库的 javadoc 位置属性可以是 URL、本地目录或本地存档文件。
注意到您的编辑后,我可能想提一下 Ant 有一个 javadoc 任务可以在构建期间生成您的javadoc。
If you don't want to include the entire source code with your .jar, you can zip/jar up just the javadocs (however you generate them.. I do it using the Project->Generate Javadoc menu option in Eclipse). An end user can then "attach" them to the referenced library in the project build path settings.
The javadoc location attribute of a project library can be a URL, a local directory or a local archive file.
After noticing your edits, I might want to mention that Ant has a javadoc task that can generate your javadocs during a build.
Maven 有一种非常优雅的方式来处理这个问题。
第 1 步:生成 javadocs 的 Maven 方式: http://maven.apache.org/plugins/maven-javadoc-plugin/
步骤 2:确保 Eclipse 始终附加这些文档,使用 maven-eclipse-plugin< /a>
完成这两个步骤后,API jar 的使用者将始终拥有最新的 javadoc,无需进一步干预
Maven has a very elegant way of handling this.
Step 1: The Maven way to generate javadocs: http://maven.apache.org/plugins/maven-javadoc-plugin/
Step 2: To ensure Eclipse always attaches these docs, use the maven-eclipse-plugin
Once these two steps are done, the consumers of your API jars will always have your latest javadocs with no further intervention
在 Eclipse 中,导出带有源的项目。
执行文件 ->导出...-> Java-> JAR 文件 -> Next
然后选择复选框 Export java source files and resources。
然后继续直到创建 JAR。
编辑:问题编辑后,此答案不再有效,但仍然有用。
In Eclipse, export the project with sources.
Do File -> Export... -> Java -> JAR File -> Next
Then select the checkbox Export java source files and resources.
Then go on until the JAR is created.
Edit: after the edits in the question, this answer is no longer valid, but it is still useful.