Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK 11+ and Javadoc

Exit code: 1 - javadoc: error - The code being documented uses packages in the unnamed module, but the packages defined in https://docs.oracle.com/en/java/javase/11/docs/api/ are in named modules. 

Has anyone been able to make javadoc work without having to change the source version to 1.8 (as suggested in other forums)? I'm using JDK v11.0.5 and the issue still present (also with JDK 12+).

Edit: This error originated from maven and thrown by the maven-javadoc-plugin. I have not been able to make it work for JDK 11+ even with the <source>8</source> configuration.

like image 648
Rafael Ibasco Avatar asked Nov 13 '19 12:11

Rafael Ibasco


People also ask

Is Javadoc included in JDK?

Fortunately, all modern versions of the JDK provide the Javadoc tool – for generating API documentation from comments present in the source code. Prerequisites: JDK 1.4 (JDK 7+ is recommended for the latest version of the Maven Javadoc plugin)

Is JDK 11 outdated?

It has been replaced by java. security. Policy and related classes since 1.2. This class is deprecated and subject to removal in a future version of Java SE.

What is JDK 11?

JDK 11 is the open-source reference implementation of version 11 of the Java SE Platform as specified by by JSR 384 in the Java Community Process. JDK 11 reached General Availability on 25 September 2018. Production-ready binaries under the GPL are available from Oracle; binaries from other vendors will follow shortly.

Is OpenJDK 11 same as Oracle JDK?

There's no real technical difference between the two, since the build process for Oracle JDK is based on that of OpenJDK. When it comes to performance, Oracle's is much better regarding responsiveness and JVM performance. It puts more focus on stability because of the importance it gives to its enterprise customers.


1 Answers

As suggested in OpenJDK issue tracker this can be worked around with defining source on Javadoc plugin:

<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-javadoc-plugin</artifactId>     <configuration>         <source>8</source>     </configuration> </plugin> 
like image 147
Roman Grigoriadi Avatar answered Oct 05 '22 23:10

Roman Grigoriadi