Add support for forward compilation
Use the javac --release flag over -source and -target to make sure the compiler
reflect JDK API differences as well.
@@ -665,6 +665,12 @@ THE SOFTWARE.
<!-- TODO: https://issues.jenkins-ci.org/browse/JENKINS-53788 (JDK11 issue on CI) -->
<doclint>none</doclint>
<maven.javadoc.skip>true</maven.javadoc.skip>
+ <!-- release is needed for reliable cross compilation. It is supported
+ starting JDK 9, but as the only earlier version we support is 8, it would
+ be either compiled by javac from 8 or one from a newer compiler that
+ correctly handle the release flag. This will replace both source and target
+ once we drop support for JDK 8 that only recognize source and target. -->
+ <maven.compiler.release>${java.level}</maven.compiler.release>
</properties>
<activation>
<jdk>11</jdk>
