Maven is not working in Java 8 when Javadoc tags are incomplete
To quickly bypass Maven Java 8 Javadoc issues, configure the maven-javadoc-plugin
to ignore errors. In your pom.xml
, include the following snippet:
This setup prevents build failures when encountering Javadoc errors, thus enabling Maven builds to continue unimpeded.
Strategy for dealing with incomplete Javadoc tags and Java 8
Fixing Javadoc errors: Primary approach
While ignoring errors could be a quick fix, it's crucial to address Javadoc issues into your source code when you can. A clean, correct Javadoc is the first line of defense against future bugs or confusion.
Dealing with Java 8 DocLint: Set and forget
Java 8 initiated DocLint, which has strict Javadoc checks for quality control. To disable DocLint, add -Xdoclint:none
into <additionalparam>
in your maven-javadoc-plugin
:
Profiling in Javadoc: As per JDK need
Create a Maven profile which targets only Java 8 builds. This strategy helps to maintain compatibility with other JDK versions:
Enjoy multi-JDK compatibility: Test, test, and test!
Test your code across various JDKs, namely 6, 7, 8, and 11. Use dynamic checking with Continuous Integration software to assure your documentation builds in all environments.
Mojo for different scenarios on Maven
Catering to Maven 3.0.0 users: Join the club!
For users of Maven 3.0.0, replace <additionalparam>
with <doclint>
. This action is due to specific plugin configurations according to the versions.
DRY principle for Javadoc plugin management: Let's get organized!
Keep your sanity intact by grouping all parameters into <properties>
. Boom, your <additionalparam>
is now configurable:
Use the ${javadoc.opts}
to refer to these parameters within your maven-javadoc-plugin
:
Be all-inclusive with configurations: Combine forces!
Often, a combination of different solutions based on individual project needs gives the optimal configuration strategy. So, manage dependencies, profiles, and even plugin configurations to up your Maven game.
Was this article helpful?