应如何分发库的 Javadoc?

发布于 2024-09-26 07:44:32 字数 304 浏览 0 评论 0原文

我正在编写一个自定义库。它被构建到 .jar 存档中。我完全能够生成 javadoc,但我不知道应该如何分发它?

  1. 将其与库放在同一个 .jar 中
  2. 将其放在不同的 .jar 中
  3. 还有其他方式吗?

以及如何将 javadoc 包含在使用我的库的另一个项目中?

  1. 如果我把它放在同一个 .jar 中,我应该在清单中写一些东西吗?
  2. 如果它位于单独的 .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?

  1. Put it in the same .jar with the library
  2. Put it in a different .jar
  3. Some other way?

And how to include the javadoc in another project that uses my lib?

  1. If I had put it in the same .jar, should I have written something in the manifest?
  2. If it's in a separate .jar, is including it in the project enough?

I am using NetBeans 9.1.

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

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

发布评论

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

评论(3

情绪失控 2024-10-03 07:44:32

我会将库 .jar 和文档以及其他内容(例如自述文件、许可证文件等)包含在单个存档(zip 或 tar.gz)

mylib-1.0.1.tar.gz

mylib-1.0.1/
           ├── javadoc
           │   └── index.html  (and all other javadoc files under here)
           ├── mylib-1.0.1.jar
           └── README

中 ,其中包含:扩展存档中的 javadoc/ 子目录,您可以将压缩的 javadoc 添加到 mylib-1.0.1-javadoc.jar (或 zip) 中,这两个选项都很常见。

mylib-1.0.1/
           ├── mylib-1.0.1-javadoc.jar
           ├── mylib-1.0.1.jar
           └── README

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:

mylib-1.0.1/
           ├── javadoc
           │   └── index.html  (and all other javadoc files under here)
           ├── mylib-1.0.1.jar
           └── README

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.

mylib-1.0.1/
           ├── mylib-1.0.1-javadoc.jar
           ├── mylib-1.0.1.jar
           └── README
空‖城人不在 2024-10-03 07:44:32

通常的做法是将 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.

大姐,你呐 2024-10-03 07:44:32

另一种方式:
对我来说,这是最好的选择:(添加到 build.xml。我已经在 NetBeans IDE 7.0 和 7.2.1 上测试了它)(在 在 Netbeans 中自动生成源代码和文档 jar )

<target name="-post-jar" description="bundle sources and javadoc in a jar" depends="javadoc">
<jar compress="${jar.compress}" basedir="${src.dir}" jarfile="${dist.dir}/${application.title}-sources.jar"/>
<jar compress="${jar.compress}" basedir="${test.src.dir}" jarfile="${dist.dir}/${application.title}-test.jar"/>
<jar compress="${jar.compress}" basedir="${dist.javadoc.dir}" jarfile="${dist.dir}/${application.title}-javadoc.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 )

<target name="-post-jar" description="bundle sources and javadoc in a jar" depends="javadoc">
<jar compress="${jar.compress}" basedir="${src.dir}" jarfile="${dist.dir}/${application.title}-sources.jar"/>
<jar compress="${jar.compress}" basedir="${test.src.dir}" jarfile="${dist.dir}/${application.title}-test.jar"/>
<jar compress="${jar.compress}" basedir="${dist.javadoc.dir}" jarfile="${dist.dir}/${application.title}-javadoc.jar"/>

This will create four jars, one to application program, one to sources, one to tests and one to javadoc.

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