A mvn release:perform
is failing due to javadocs not being created. So I tried running
mvn javadoc:javadoc
myself and I see that it fails due to the javadoc comments in the source code not having definitions for all of the parameters and return values. Errors are of the format:
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (attach-javadocs) on project my-project: MavenReportException: Error while generating Javadoc:
Exit code: 1 - /my/file.java:36: warning: no description for @return
This, however, used to work. So what changed?
I checked the maven-javadoc-plugin documentation and it now (in v3.0) says the parameter is not additionalParam, or additionalparam, but additionalOptions, and additionalJOptions. See maven-javadoc-plugin documentation.
When I searched for the parameter additionalParam, it does not appear. I'm confused how this could have worked. Searching for answers some people say to use what I'm using, others say to use additionalJOption. See Maven is not working in Java 8 when Javadoc tags are incomplete.
Any ideas on what caused the problem and how to fix it?
Luckily, I found a work around which was to disable the Javadoc linting from the command line:
mvn release:perform -Darugments="-Dmaven.javadoc.skip=true"
Kudo's to code.i-harness.com posting that gave me this work around.
So I'm passed the initial problem, but want/need to clean up the poms to remove useless parameters, or change them to the new/correct syntax (not yet tested).
Searching on SO gives these hits that were useful:
How can I disable the Maven Javadoc plugin from the command line? - Gave me the idea to search for maven.javadoc.skip which helped me find my work around.
Maven is not working in Java 8 when Javadoc tags are incomplete which says I should use additionalJOption
parameter. The same question has an answer that says to use what I'm using <additionalparam>-Xdoclint:none</additionalparam>
You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).
The Javadoc Plugin uses the Javadoc tool to generate javadocs for the specified project. For more information about the standard Javadoc tool, please refer to Reference Guide. The Javadoc Plugin gets the parameter values that will be used from the plugin configuration specified in the pom.
The magic incantation you need is -Xdoclint:none . This goes on the command line invoking Javadoc.
Java DocLint is a tool to analyze our Javadoc. It throws warnings and errors whenever it finds bad syntax. In this tutorial, we focus on how we can use it. Later, we'll look at the problems it can create in certain situations, along with some guidelines on how we can avoid them.
You should use the doclint option instead:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<doclint>none</doclint>
</configuration>
</plugin>
This will skip all checks. Generally, I would recommend to run all checks except for missing @return and @param. So instead of none
, you could use:
<doclint>all,-missing</doclint>
Individual groups of checks can be switched on or off (like the -missing
above). A detailed description of the groups can be found in the javadoc documentation (at the bottom of the page).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With