Improve Java Builds with Conditional Compiler Options for JDK-8 Compatibility #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds conditional handling for
--source
and--target
and--release
compiler arguments in Maven-based builds.The POM for Java-based project source templates is adjusted conditionally such that when Java 8 support is specified by the user as a requirement, then the POM will have two additional profiles which are activated based on the JDK version which is used to build the project. This effectively instructs Maven to add the
--source
and--target
arguments as compiler options when using JDK-8. However, when using JDK-9 or higher, only the--release
argument must be specified as a compiler option. This ensures complete compatibility of the produced class files with the minimum specified Java version.When support for Java 8 is not required by the project, then the Maven profiles are not added and the
--release
compiler option is simply specified in the POMs project properties.The Maven compiler plugin is added to the affected POMs as an explicit declaration with version 3.12.1 of the plugin.
The Maven JAR plugin is updated to version 3.3.0 of the plugin in all affected POMs.