[
https://issues.apache.org/jira/browse/MJAVADOC-768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17958145#comment-17958145
]
Olivier Lamy commented on MJAVADOC-768:
---------------------------------------
This project has moved from Jira to GitHub Issues. This issue was migrated to
[apache/maven-javadoc-plugin#1150|https://github.com/apache/maven-javadoc-plugin/issues/1150].
Please visit the GitHub issue to view further activity, add comments, or
subscribe to receive notifications.
> javadoc has a hard time with JPMS and provided or optional module
> dependencies.
> -------------------------------------------------------------------------------
>
> Key: MJAVADOC-768
> URL: https://issues.apache.org/jira/browse/MJAVADOC-768
> Project: Maven Javadoc Plugin (Moved to GitHub Issues)
> Issue Type: Bug
> Components: jar, javadoc
> Affects Versions: 3.5.0
> Reporter: Henning Schmiedehausen
> Priority: Major
> Labels: jpms
>
> Check out this project: [https://github.com/hgschmie/mjavadoc768/]
> run {{mvn clean install}} in the root. This results in this error:
> {code}
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-javadoc-plugin:3.5.0:aggregate-jar
> (javadoc-jar) on project doc: MavenReportException: Error while generating
> Javadoc:
> [ERROR] Exit code: 1
> [ERROR] /Users/henning/scratch/jdbug/thing2/src/main/java/module-info.java:4:
> error: module not found: jakarta.annotation
> [ERROR] requires static jakarta.annotation;
> [ERROR] ^
> [ERROR] /Users/henning/scratch/jdbug/thing1/src/main/java/module-info.java:4:
> error: module not found: jakarta.annotation
> [ERROR] requires static jakarta.annotation;
> [ERROR] ^
> [ERROR] 2 errors
> [ERROR] Command line was:
> /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/javadoc
> -J-Xmx1024m @options @packages @argfile
> [ERROR]
> [ERROR] Refer to the generated Javadoc files in
> '/Users/henning/scratch/jdbug/doc/target/apidocs' dir.
> {code}
> The problem is that both maven modules (thing1 and thing2) declare a compile
> time dependency on "jakarta-annotation" using either maven {{provided}} scope
> or maven {{optional}}. This is reflected in the JPMS module descriptor by
> using `required static jakarta.annotation;`.
> But the javadoc tool, when it wants to generate the aggregation jar,
> generates an options file that does not contain the jakarta-annotation jar on
> the module path (which is needed for javadoc to succeed), so the tool reports
> the error above. The javadoc tool needs to add all provided and optional
> dependencies to the module path for the aggregated jar.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)