JDK-8252531 : [macos]--add-modules ALL-MODULE-PATH not allowed with automatic modules
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 11.0.8
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2020-07-27
  • Updated: 2020-08-29
  • Resolved: 2020-08-29
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
When generating javadoc for an automatic module, the javadoc tool adds the arguments --add-modules ALL-MODULE-PATH. This throws the error "--add-modules ALL-MODULE-PATH can only be used when compiling the unnamed module"

This is similar to bug https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8220702 which was fixed in JDK13 

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create module with automatic-module-name in manifest
2. Run "mvn clean install javadoc:jar" under JDK 11.0.8


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Javadoc is generated
ACTUAL -
Build fails with: --add-modules ALL-MODULE-PATH can only be used when compiling the unnamed module

FREQUENCY : always



Comments
As per the submitter comments, closing it as Not an Issue.
05-08-2020

Additional Information from submitter ========================== After further testing, the problem seemed to have been caused by (incorrectly) binding the javadoc:aggregate goal to the maven package-phase: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>aggregate</id> <goals> <goal>aggregate</goal> </goals> <phase>package</phase> <configuration> <sourcepath>src/main/java</sourcepath> </configuration> </execution> </executions> </plugin> After removing this configuration, the problem is fixed. It is unclear if the error that got caused by this is incorrect.
31-07-2020

Taking the same example as https://bugs.openjdk.java.net/browse/JDK-8220702, I was not able to reproduce the issue on MAC OS with Oracle JDK 11.0.8. Maven was able to successfully build without any errors.
30-07-2020