应如何分发库的 Javadoc?
我正在编写一个自定义库。它被构建到 .jar 存档中。我完全能够生成 javadoc,但我不知道应该如何分发它?
- 将其与库放在同一个 .jar 中
- 将其放在不同的 .jar 中
- 还有其他方式吗?
以及如何将 javadoc 包含在使用我的库的另一个项目中?
- 如果我把它放在同一个 .jar 中,我应该在清单中写一些东西吗?
- 如果它位于单独的 .jar 中,将其包含在项目中就足够了吗?
我正在使用 NetBeans 9.1。
I am writing a custom library. It's build into a .jar archive. I am fully able to generate the javadoc, but I don't know how I should distribute it?
- Put it in the same .jar with the library
- Put it in a different .jar
- Some other way?
And how to include the javadoc in another project that uses my lib?
- If I had put it in the same .jar, should I have written something in the manifest?
- If it's in a separate .jar, is including it in the project enough?
I am using NetBeans 9.1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会将库 .jar 和文档以及其他内容(例如自述文件、许可证文件等)包含在单个存档(zip 或 tar.gz)
mylib-1.0.1.tar.gz
中 ,其中包含:扩展存档中的 javadoc/ 子目录,您可以将压缩的 javadoc 添加到 mylib-1.0.1-javadoc.jar (或 zip) 中,这两个选项都很常见。
I'd include the library .jar and the documentation and other things, like a README, License file etc. in a single archive (zip or tar.gz)
mylib-1.0.1.tar.gz , which contains:
Instead of the expanded javadoc/ sub directory within the archive, you could add the compressed javadoc in a mylib-1.0.1-javadoc.jar (or zip) , both options are common.
通常的做法是将 JavaDocs 保存在单独的存档中。或者更常见的是,在名为“docs”的目录中。您不想不必要地用 html 和 js 文件来膨胀您的库的存档。
为什么您希望将生成的 JavaDocs [html + js] 包含在您的项目中?只要源代码 JavaDoc 注释就位,使用您的库的人只需将鼠标悬停在任何现代 IDE 的
更新
中即可看到它们
根据下面南达的评论,我检查了同样的内容,他是正确的。在我的项目中,我实际上已将“doc”文件夹中的 Javadocs 附加到存档中,以便能够在鼠标悬停时查看它们。
It's a general practice to keep the JavaDocs in a separate archive. or even more commonly, in a directory called 'docs'. you do not needlessly want to bloat your library's archive with the html and js files.
And why would you want to include the generated JavaDocs [html + js] in your project? As long the source code JavaDoc comments are in place, someone using your library will be able to see them by simply hovering over w/ the mouse in any of the modern IDE's
Update
As per nanda's comment below, I checked the same and he IS correct. In my project, I have actually attached Javadocs from the 'doc' folder to the archive to be able to view them on mouseover.
另一种方式:
对我来说,这是最好的选择:(添加到 build.xml。我已经在 NetBeans IDE 7.0 和 7.2.1 上测试了它)(在 在 Netbeans 中自动生成源代码和文档 jar )
这将创建四个 jar,一个用于应用程序,一个用于源,一个用于测试,一个用于 javadoc。
Another way:
For me this was the best choise: (addingto build.xml. I've tested it on NetBeans IDE 7.0 and 7.2.1) (found it on Automatically generating source and doc jars in Netbeans )
This will create four jars, one to application program, one to sources, one to tests and one to javadoc.