Description
Affected version
3.11.3-SNAPSHOT
Bug description
Since JPMS, and finding a module-info.java path inside the source directories, mvn javadoc:javadoc insist that the compiles code should be compiled first, or at least it gives a warning to that effect.
However, the JDK javadoc tool when used on the command line, has no such requirement. This is odd.
Also non-JMPS projects do not show this behaviour.
To show the effect, take a JPMS project, add the debug parameter to the javadoc-plugin setup
and runmvn clean javadoc:javadoc
.
Then run mvn clean compile javadoc:javadoc
, which works as expected.
The debug flag set earlier leaves the command line instrumentation in the target/reports/apidocs directory.
javadoc.sh
the generated script with used filesoptions
this contains workdir specific valuespackages
sic@argfile
which specifies the module name
The script contains a call to the JDK command line tool, in my case
/usr/lib/jvm/jdk-21.0.7+6/bin/javadoc -J-Duser.language= -J-Duser.country= @options @packages @argfile
The options file specifies the output directory equivalent to the standard place for the produced apidoc.
Copy these files to the basedir for instance (linux) with
cp target/reports/apidocs/{javadoc.sh,options,packages,argfile} .
Now you are set for the experiment
First clean mvn clean
Then ./javadoc.sh
inside the basedir.
This shows that the JDK javadoc tool does NOT require the code to be compiled.
Example project:
JavadocTest.zip