Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@link to another package inside of a package-info.java

Tags:

java

javadoc

Is there any way to link from an package-info.java to another package outside of this package (in the same Project)?

If I try to do this in java 7 I always get:

warning - Tag @link: reference not found:
like image 473
someonr Avatar asked Jul 04 '12 05:07

someonr


People also ask

Can you have a package inside another package Java?

There is no concept of package with in package. Each package is separate namespace.

Can a package contain other packages?

A package can contain modules(. py files) because they depend on each other and sometimes may not work correctly, or at all. There is always a common goal of every part (module/file) of a package, and the total sum of all of the parts is the package itself.

Can we use 2 packages in Java?

You cannot put package declaration twice in the same class. The package statement must be the first line in the source file. There can be only one package statement in each source file, and it applies to all types in the file.

What is Packageinfo Java?

The package-info. java is a Java file that can be added to any Java source package. Its purpose is to provide a home for package level documentation and package level annotations.


1 Answers

Both @link and @see support linking to packages.

I have the following code in one of my package-info.java files and the javadoc tool generates the link:

/**
 * <p>Note, however, that the classes in {@link gov.va.med.srcalc.domain}
 * define the vast majority of the data mapping via JPA annotations.</p>
 */
package gov.va.med.srcalc.db;

We use Gradle as our build tool and I have found, however, that Gradle does not generate the link and produces a reference not found: gov.va.med.srcalc.domain warning. Maybe it's a bug in Gradle.

like image 187
David Avatar answered Sep 19 '22 09:09

David