While building 1.10.0-rc3, I wanted to experiment with the compilation and
runtime variants using Java 8 and Java 11.  The summary of this experiment
was:

Comp: Java 8   Run: Java 8  =>  SUCCESS
Comp: Java 8   Run: Java 11 =>  SUCCESS
Comp: Java 11  Run: Java 8  =>  FAILURE
Comp: Java 11  Run: Java 11 =>  SUCCESS

As introduced in JEP-247 [1], starting with Java 9, javac has the ability
to compile to an older Java platform.  This was not possible previously
without having multiple JDKs installed and specifying the '-bootclasspath'
option in javac for your target.

The newly introduced "--release" option to Java 9+ javac allows you to
specify the target version using the documented API for that platform.
This means replacing the '-source' and '-target' parameters with the
'--release' option instead.

In maven, that manifests itself as a configuration option to the
maven-compiler-plugin, which is the 'maven.compiler.release' property. [2]

The discussion here would be consideration for using the "release" option
as opposed to our current setup which uses "source" and "target".  The
benefit would be that all the deployment scenarios (above) could result in
success.

The downside though is that, without other changes, Java 11 would be
required to compile NiFi.  It would still target Java 8 as a supported
runtime (specifying "release=8"), but you'd have to build/compile with Java
11.  I don't think this should be a problem, but it's worth discussion.

Thanks,
Adam

[1]  https://openjdk.java.net/jeps/247
[2]
https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#release

Reply via email to