Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8212233

javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."

    XMLWordPrintable

Details

    Backports

      Description

        UPDATE FOR THOSE WHO GOOGLED THIS BUG:
        If the project uses source/target 8, adding <source>8</source> in javadoc configuration should make the project buildable on jdk {11, 12, 13}:

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <source>8</source>
            </configuration>
             ...
          </plugin>

        ------

        Take the simple Maven project with latest plugin dependencies (for example, http://cr.openjdk.java.net/~shade/8212233/javadoc-bug.tar.gz ), and run with JDK 11 and then with current JDK 12 EA. JDK 11 build would succeed (UPD: it would with JDK 11 GA, but not with later updates), and JDK 12 EA would fail on javadoc generation, which looks like a regression. Or maybe the Maven plugins need to do some new incantation to get it right?



        I see projects started to disable Javadoc on 12 because of this:
          https://www.google.de/search?q=%22The+code+being+documented+uses+modules+but+the+packages+defined+in%22

        $ export JAVA_HOME=~/Install/jdk11-oracle-ga/
        $ export PATH=$JAVA_HOME/bin:$PATH
        $ java -version
        openjdk version "11" 2018-09-25
        OpenJDK Runtime Environment 18.9 (build 11+28)
        OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

        $ mvn clean install
        ...
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESS
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 2.345 s
        [INFO] Finished at: 2018-10-16T11:37:09+02:00
        [INFO] Final Memory: 19M/176M
        [INFO] ------------------------------------------------------------------------

        $ export JAVA_HOME=~/Install/jdk12-oracle-b15/
        $ export PATH=$JAVA_HOME/bin:$PATH
        $ java -version
        openjdk version "12-ea" 2019-03-19
        OpenJDK Runtime Environment (build 12-ea+15)
        OpenJDK 64-Bit Server VM (build 12-ea+15, mixed mode, sharing)

        $ mvn clean install
        ...
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 4.415 s
        [INFO] Finished at: 2018-10-16T11:38:35+02:00
        [INFO] Final Memory: 25M/200M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (attach-javadoc) on project bug: MavenReportException: Error while generating Javadoc:
        [ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
        [ERROR]

        Attachments

          Issue Links

            Activity

              People

                jjg Jonathan Gibbons
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: