Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Javadoc warnings in Maven Javadoc Plugin?

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])?

like image 815
Martin Monperrus Avatar asked Sep 21 '16 12:09

Martin Monperrus


People also ask

How do I disable Javadoc in Maven?

The Javadoc generation can be skipped by setting the property maven. javadoc. skip to true [1], i.e.

Which will prevent Javadoc from being generated while using Doclint?

The magic incantation you need is -Xdoclint:none . This goes on the command line invoking Javadoc.

How do I fix Javadoc errors?

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).

How do I add a note in Javadoc?

Generally, the first sentence of Javadoc should give a brief description of the class/method/field. Then the full description should follow. And if you want to include any notes, a specialized paragraph with a "Note:" prepended should suffice. Generally if you open (xml-)tags you should close them somewhere.


1 Answers

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> 
like image 73
Gray Avatar answered Oct 14 '22 22:10

Gray