martinaldrin opened a new issue, #1312:
URL: https://github.com/apache/maven-javadoc-plugin/issues/1312

   ### Affected version
   
   3.12.1-SNAPSHOT
   
   ### Bug description
   
   Description:
   
   Summary
   
   When <docletPath> is configured with a relative path (e.g. 
target/test-classes), the maven-javadoc-plugin writes it verbatim to the 
javadoc options file. The javadoc tool runs from target/reports/testapidocs, 
   so the relative path resolves to 
target/reports/testapidocs/target/test-classes — which doesn't exist. This 
causes the wrong class to be loaded from the classpath, which on Java 25 
triggers a fatal assertion 
   error:
   
   error: fatal error encountered: java.lang.AssertionError: ignored flag: 
-Xlint:-options
   [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-javadoc-plugin:3.12.1-SNAPSHOT:test-javadoc 
(test_verspec) on project <my-project>: An error has occurred in Test Javadoc 
report generation: 
   [ERROR] Exit code: 4
   [ERROR] error: fatal error encountered: java.lang.AssertionError: ignored 
flag: -Xlint:-options
   [ERROR] error: Please file a bug against the javadoc tool via the Java bug 
reporting page
   [ERROR]   (https://bugreport.java.com) after checking the Bug Database 
(https://bugs.java.com)
   [ERROR]   for duplicates. Include error messages and the following 
diagnostic in your report. Thank you.
   [ERROR] java.lang.AssertionError: ignored flag: -Xlint:-options
   [ERROR]      at 
jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
   [ERROR]      at 
jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:104)
   [ERROR]      at 
jdk.compiler/com.sun.tools.javac.util.Options.lambda$computeIfReady$0(Options.java:308)
   [ERROR]      at 
jdk.compiler/com.sun.tools.javac.util.Options.notifyListeners(Options.java:277)
   [ERROR]      at 
jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:553)
   [ERROR]      at 
jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:399)
   [ERROR]      at 
jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:348)
   [ERROR]      at 
jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:57)
   [ERROR]      at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:46)
   [ERROR] 2 errors
   [ERROR] Command line was: 
/opt/homebrew/Cellar/openjdk/25.0.2/libexec/openjdk.jdk/Contents/Home/bin/javadoc
 -J-Duser.language= -J-Duser.country= @options
   [ERROR] 
   [ERROR] Refer to the generated Javadoc files in 
'/mypath/target/reports/testapidocs' dir.
   
   
   On Java 21 and earlier this silently loaded the wrong class without 
crashing, so the bug went unnoticed.
   
   Steps to reproduce
   
   Configure maven-javadoc-plugin with a relative docletPath:
   
   xml
   <docletPath>target/test-classes</docletPath>
   
   
   Run mvn site (or any phase that triggers the javadoc execution) with Java 25.
   
   Expected behavior
   
   docletPath entries are resolved against the project base directory (absolute 
paths written to the options file), consistent with how other path parameters 
are handled.
   
   Actual behavior
   
   docletPath is written verbatim to the options file. The javadoc tool 
resolves it relative to its own working directory (target/reports/testapidocs), 
not the project root.
   
   Root cause
   
   In AbstractJavadocMojo.getDocletPath():
   
   java
   // current (broken)
   pathParts.add(JavadocUtil.unifyPathSeparator(docletPath));
   
   
   docletPath is a String field with no path resolution applied, unlike 
docletArtifact which always produces absolute paths. The fix is to resolve it 
through JavadocUtil.prunePaths() the same way tagletpath 
   entries are handled:
   
   java
   // fixed
   for (Path path : JavadocUtil.prunePaths(project, 
Arrays.asList(JavadocUtil.splitPath(docletPath)), true)) {
       pathParts.add(path.toString());
   }
   
   
   Environment
   
   - maven-javadoc-plugin: 3.12.1-SNAPSHOT
   - Azul OpenJdk: 25
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to