I was publishing two small packages to maven central and saw that they added usage tracking. I clicked and noticed 8MB number that should not be caused by 2 tiny packages, it was supposed to be kilobytes.
What happened wass that starting in JDK 23, the JDK javadoc
tool began embedding default DejaVu web font files (~4 MB) into generated API documentation. The maven-javadoc-plugin
passes the JDK's --no-fonts
flag to disable this.
Option 1: Plugin Configuration
To disable copying web fonts across builds, set <disableNoFonts>false</disableNoFonts>
(or explicitly pass additional arguments if running older toolchains) in your pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.3</version>
<configuration>
<!-- Disables font inclusion in JDK 23+ -->
<additionalOptions>
<additionalOption>--no-fonts</additionalOption>
</additionalOptions>
</configuration>
</plugin>
Option 2: Property Switch or Maven Property
You can also control this property directly via the Maven property or command-line flag without modifying your execution configuration:
mvn clean javadoc:javadoc -Dmaven.javadoc.disableNoFonts=true
JDK Compatibility Note:The--no-fonts
option was introduced inJDK 23. If you use JDK 21 or earlier, explicitly passing--no-fonts
will cause the JDKjavadoc
executable to throw an unrecognized option error.