I'm using the Maven Javadoc Plugin. It outputs warnings as follows:
[ERROR] /home/monperrus/spoon/src/main/java/spoon/visitor/CtVisitor.java:144:
warning: no @param for <T>
How to display those warnings as [WARNING]
(and not the confusing [ERROR]
)?
How to display those warnings as [WARNING] (and not the confusing [ERROR])? How to completely disable Javadoc warnings in Maven?
If you are talking about the javadoc lint warnings introduced in Java 8 then you should be able to do the following. There are multiple ways of specifying the parameters depending on which version of the javadoc plugin you are using.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<additionalOptions>-Xdoclint:none</additionalOptions>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
</plugin>
</plugins>
See this good discussion about turning off doclint .
If you are instead just want to get rid of the missing jacadocs warnings then you can use:
<configuration>
<additionalparam>-Xdoclint:all -Xdoclint:-missing</additionalparam>
<additionalOptions>-Xdoclint:all -Xdoclint:-missing</additionalOptions>
<additionalJOptions>
<additionalJOption>-Xdoclint:all</additionalJOption>
<additionalJOption>-Xdoclint:-missing</additionalJOption>
</additionalJOptions>
</configuration>
maven-javadoc-plugin version 2.9 onwards, setting additionalparam, doesn't seem to work. The new option that needs to be set is additionalJOption (see documentation ). An example here:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
</plugin>
Note that the warning are still displayed in the console, but not with the confusing "[ERROR]" prefix.
Note also, per the code of maven-javadoc-plugin
that if there is at least one Javadoc error, all log lines will be prefixed by [ERROR]
.
You can also disable it from the command line, in case you just want to locally suppress but not codify.
mvn clean install -Dadditionalparam=-Xdoclint:none
as Spring Monkey points out, in newer versions you may have to pass it in as
mvn clean install -DadditionalJOption=-Xdoclint:none
Since version 3.0.0 of the maven-javadoc-plugin
you can use the doclint
configuration parameter. If you just want to disable the "missing" warnings, use all,-missing
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<doclint>all,-missing</doclint>
</configuration>
</plugin>
For more information see the doclint
parameter documentation .
Compiling all the answers, and adding something else, we have the following.
To configure the maven project you should add this to the pom file:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<additionalJOption>-Xdoclint:none</additionalOptions>
</configuration>
</plugin>
</plugins>
For Maven 2.9+ you need additionalJOption
, and before that you need additionalparam
. You can have additionalparam
on Maven 2.9+ as it won't cause errors, but it won't make it work. I have not tested having additionalJOption
on earlier versions of maven.
To configure it from the command line , you should pass this parameter:
mvn <goals> -Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none
To configure it on your shell environment , so that it will apply every time to every project without you needing to do anything else, add this line to your shell initialization ( ~/.bashrc
or on Macs ~/.bash_profile
, or whatever else your shell uses):
export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none"
Or, if you have a JAVA_TOOL_OPTIONS
, append those parameters to it.
From v3.0.0, new doclint
config option is added to configure the doc linting. This can be used to suppress these warnings.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<doclint>none</doclint> <!-- Turnoff all checks -->
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
For < v3.0.0, use as mentioned in previous answers
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam> <!-- Turnoff all checks -->
</configuration>
<!-- executions.... -->
</plugin>
</plugins>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.