Sunday, 27 November 2016

Package-level javadoc comments

Problem:

How can I add package-level javadoc comments to my Java project?

Solution:

  • In your package's directory, add a file named "package-info.java"
  • In this file, include the package-level javadoc comment, as well as the package declaration

Example:

myprojectroot/mypackage/package-info.java:

/**
 * Provides an example package-level javadoc comment.
 * 
 * @since 1.0
 */
package myprojectroot.mypackage;

Additional hints:

  • in Eclipse, you can create this file by adding a "new file" to the package (instead of a new Java class, etc.)

References:

No comments:

Post a Comment