Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jdk 11 build #32

Merged
merged 3 commits into from Apr 1, 2019
Merged

Jdk 11 build #32

merged 3 commits into from Apr 1, 2019

Conversation

aherbert
Copy link
Contributor

This fix allows:

mvn clean package site

to work on JDK 8 and 11.

mvn clean package site -P commons-rng-examples

does not work. Javadoc generation fails for the JPMS modules. The javadoc tool complains about links to a Javadoc API in the unamed modules:

The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/9/docs/api/ are in the unnamed module.

This javadoc issue when building using JDK 11 for a source earlier than 11 is found in a lot of web posts. The fix that works for a source earlier than 9 (i.e. using the <source>7</source> tag in the maven javadoc configuration) does not work when the source is 9 and has modules.

One simple workaround is to not use JDK 11 to build javadocs.

This requires a HTML 5 compliant <table> in the MersenneTwister javadocs
and a new <caption> element to replace the summary attribute.

Note: The JPMS modules fail. The javadoc tool for java 11 will not support links to older java APIs when building for a Java 9 source due to "packages in the unamed module".
@aherbert
Copy link
Contributor Author

To confirm. Setting the JPMS modules to have a source of 11 with default settings allows javadocs to be built. Here's a snippet with a maven-javadoc-plugin that overrides the parent and so resets all configuration. This works:

    <!-- Java language level. -->
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <animal.sniffer.skip>true</animal.sniffer.skip>
    <maven.compiler.release>11</maven.compiler.release>
  </properties>

  <build>
    <plugins>
      <!--  Revert javadoc fix in parent -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration combine.self="override">
          <source>11</source>
        </configuration>
      </plugin>
    </plugins>
  </build>

However this omits some of the configuration added by commons-parent and comons-rng-parent for the javadocs, e.g. MathJax support.

It may be that support for java 9 should be dropped in favour of java 11 and the project fixed as above but adding back the desired javadoc configuration.

@coveralls
Copy link

coveralls commented Mar 24, 2019

Coverage Status

Coverage increased (+0.007%) to 98.246% when pulling 82b19d7 on aherbert:jdk-11-build into 85c9744 on apache:master.

@aherbert
Copy link
Contributor Author

Note:

Javadoc generation does not work on JDK 11.0.2 due to the packages in the unamed module error. A fix for this is present in JDK 11.0.3 (See JDK-8212233).

I tried upgrading the pom to allow javadoc generation using JDK 11 using an explicit source/release of 11. This required (note the javadoc-plugin fix above was incorrect:

    <!-- Java language level. -->
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <animal.sniffer.skip>true</animal.sniffer.skip>
    <maven.compiler.release>11</maven.compiler.release>
  </properties>

  <plugin>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <!-- Reset API links since these refer to java 1.6 and 1.7 -->
      <links combine.self="override" />
    </configuration>
  </plugin>

<!-- upgrade for java 11 -->
maven-compiler-plugin -> 3.8.0
maven-surefire-plugin -> 3.0.0-M3
maven-surefire-report-plugin -> 3.0.0-M3

Then the the site plugin fails on default-site goal:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site
(default-site) on project commons-rng-examples-jpms-lib: Execution default-site of
goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site failed:
org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '11'.

Currently it seems that the maven plugins have yet to catch up to java 11. The solution is to fix the main build command for java 11 and stick to supporting the full build with the examples modules on JDK 9.

This works.

JDK 11

mvn clean package -P commons-rng-examples

JDK 9

mvn clean package site site:stage -P commons-rng-examples

JDK 8

mvn clean package site site:stage

This can be revisited when JDK 11.0.3 is released (if ever) and the Maven plugins catch up to Java 11.

@aherbert aherbert merged commit 5db7bee into apache:master Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants