We use the maven-compiler-plugin's maven.compiler.release property
to configure the --release value when building on JDK 9 or
later. Using --release is preferable to using --source/--target as
--release also factors in the class libraries available in the
release.
Unfortunately, setting this property when building on JDK 8 causes a
build error as the maven-compiler-plugin passes the --release option
to javac which does not understand it. So we use a maven profile to
set the property only when JDK is 9 or higher.
We use the maven-compiler-plugin's
maven.compiler.release
property to configure the --release value when building on JDK 9 or later. Using --release is preferable to using --source/--target as --release also factors in the class libraries available in the release.Unfortunately, setting this property when building on JDK 8 causes a build error as the maven-compiler-plugin passes the --release option to javac which does not understand it. So we use a maven profile to set the property only when JDK is 9 or higher.