我可以使用Eclipse轻松地将JavaDoc添加到包中吗? [英] Can I add JavaDoc to a package easily with Eclipse?

查看:112
本文介绍了我可以使用Eclipse轻松地将JavaDoc添加到包中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用javadoc记录我的类和方法。我也想在我的包中添加一些概述信息。我喜欢Eclipse键入 / **< Enter> 之后,为每个类或方法创建一个匹配的文档注释的存根。 Eclipse有一个简单的方法来生成 package.html file

解决方案

更新4年后(2013年10月)



javabeangrinder 答案(upvoted)提到了以下技巧:


创建一个 package-info.java 现有包中的文件:





  • 右键单击要包含的包 package-info.java

  • 选择 new-> package

  • 检查创建package.info.java 复选框。

  • 点击完成






2009)



没有模板或向导轻松创建一个package.html文件。



由于 mmyers 说在他的评论中,由于 Java1.5 ,要创建的正确文件将是 package-info.java

该文件不仅可以用于javadoc,还可以用于软件包级注释(as 这里说明)。



有一个打开Bug(#86168),要求创建一个向导来创建 package-info.java (自类向导不允许 package-info 名称)。



自2005年以来,关于该主题的反思是!问题是,任何解决方案应该以
的方式实现,它也有助于 1.4 代码。



目前的解决方法是创建一个 package-info.java 作为文本文件。

从那时起, package-info.java 表现为普通的Java类,Eclipse放置一个 package-info.class 文件在输出文件夹中。

Javadocs 正确地使用 package-info.java ,而不是 package.html 文件。



alt text http://jmdoudoux.developpez.com/cours/developpons/java/images/jaxb006.png






注意(响应草莓的评论):




  • bug 77451 (2004 !, for package.html)

  • <一个href =https://bugs.eclipse.org/bugs/show_bug.cgi?id=163633 =nofollow noreferrer> bug 163633 和 bug 163926 (2006,for package-info.java)



希望 在Javadoc
视图中的package-info.java中的软件包概述的预览 strong>。



到目前为止,还没有提出/实现补丁。

添加该功能根本没有足够的要求。 / p>

I use javadoc to document my classes and methods. I would like to add some overview information to my packages, too. I like how Eclipse creates a stub of a matching Doc Comment for each class or method once I type /**<Enter>. Does Eclipse have an easy way to generate a package.html file, too?

解决方案

Update 4 years later (Oct. 2013)

javabeangrinder's answer (upvoted) mentions the following trick:

To create a package-info.java file in an existing package:

  • Right click on the package where you want a package-info.java.
  • Select new->package.
  • Check the Create package.info.java check box.
  • Click on Finish

Original answer (May 2009)

There is no template or wizard to easily create a package.html file.

As mmyers said in his comment, since Java1.5, the correct file to create would be package-info.java.
That file can be used not only for javadocs, but also for package-level annotations (as illustrated here).

There is an opened Bug (#86168) for demanding a wizard for the creation of package-info.java (since the class wizard does not allow the package-info name).

The reflections on that topic are on since... 2005! The problem is that any solution should be implemented in a way that it also helps with 1.4 code.

The current workaround is to create a package-info.java as a text file.
From that point forward, package-info.java behaves as a normal Java class, and Eclipse places a package-info.class file in the output folder.
The Javadocs are correctly built using package-info.java, and not the package.html file.

alt text http://jmdoudoux.developpez.com/cours/developpons/java/images/jaxb006.png


Note (in response to Strawberry's comment):

both wish a preview of the package overview in package-info.java in the Javadoc view.

So far, no patch has been proposed/implemented.
There is simply not enough demands for that feature to be added.

这篇关于我可以使用Eclipse轻松地将JavaDoc添加到包中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆