I have a simple project with src/main/java/test/Test.java
package test;
/**
* Class java doc
*/
public class Test
{
/**
* Wrong java doc
*
* @param test
* @return
*/
public int aMethod(int param){
return 0;
}
}
and pom.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When building on Linux with oracle-jdk8 (161) it fails because of the incorrect javadoc
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:jar (attach-javadocs) on project test: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /home/D070061/SAPDevelop/test/src/main/java/test/Test.java:10: error: @param name not found
[ERROR] * @param test
When doing the same with open-jdk8 (v171) the build is successful
I switch the java with sudo update-alternatives --config java
Does anybody know why it doesn't fail on OpenJDK? Is it a bug or is there some special parameters needed?
It appears that Debian patches javadoc to disable doclint by default, as presumably do some derived and other distributions.
The Maven Javadoc plugin added a <doclint>
configuration item in 3.0.0, so for that version and later you should be able to re-enable doclint by specifying e.g.:
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<doclint>all</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>