Say I have the following package structure:
When I generate the javadoc, I will get the following under index.html
:
I find that inconvenient for two reasons:
package-info.java
only appears at the level of com.company.framework
package (which contains no class) and the other two sub-packages which actually contain classes have an empty description.I would like to somehow "aggregate" (or collapse?) the package so that I can get only com.company.framework
, and then expanding this I can get just a
and b
.
Is that achievable using Javadoc?
My setup if needed:
maven plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<overview>${basedir}/javadoc/overview.html</overview>
</configuration>
<executions>
<execution>
<id>aggregate</id>
<goals>
<goal>aggregate</goal>
</goals>
<configuration>
<reportOutputDirectory>${basedir}/framework-doc/</reportOutputDirectory>
</configuration>
</execution>
</executions>
</plugin>
The command I use to build the javadoc:
mvn javadoc:aggregate
Finally, the right place to look for was the Grouping Packages functionality of the javadoc maven plugin.
Official documentation: here
Sample:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<overview>${basedir}/javadoc/overview.html</overview>
<groups>
<group>
<title>Package A</title>
<packages>com.company.framework.a*</packages>
</group>
</groups>
</configuration>
<executions>
<execution>
<id>aggregate</id>
<goals>
<goal>aggregate</goal>
</goals>
<configuration>
<reportOutputDirectory>${basedir}/framework-doc/</reportOutputDirectory>
</configuration>
</execution>
</executions>
</plugin>