Uploaded image for project: 'Maven Javadoc Plugin'
  1. Maven Javadoc Plugin
  2. MJAVADOC-768

javadoc has a hard time with JPMS and provided or optional module dependencies.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.0
    • None
    • jar, javadoc

    Description

      Check out this project: https://github.com/hgschmie/mjavadoc768/

      run mvn clean install in the root. This results in this error:

      [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.
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            henning Henning Schmiedehausen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: