Build on jdk8plus#23
Merged
Merged
Conversation
tinevez
added a commit
to mastodon-sc/mastodon-tracking
that referenced
this pull request
Oct 5, 2020
Taken from @axtimwalde PR on pom-scijava-base scijava/pom-scijava-base#23
a3de667 to
2de8859
Compare
Starting with Java 9, the --release flag makes it possible to compile Java code with a given version of the JDK but targeting an earlier version of the Java API. The --source and --target flags alone are not enough to guarantee this; the bootclasspath must also be set appropriately, which the --release flag takes care of doing. This change passes the value of the scijava.jvm.version property for --release, as long as the version of Java being used is 9 or later. With this enhancement, it is no longer necessary to restrict the build environment (scijava.jvm.build.version) to Java 8 only. This change could potentially be breaking for projects that override scijava.jvm.version with a version like 1.6, because the --release flag does not accept the 1.x syntax, only the new-style 6, 7, 8, etc. Therefore, we bump the major digit, to indicate that adjustment may be necessary in downstream POMs. Co-authored-by: Curtis Rueden <ctrueden@wisc.edu>
2de8859 to
bd5a646
Compare
Member
|
@axtimwalde Thanks for your efforts and patience! 🍻 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR addresses all issues raised in the closed PR #22 achieving the same objective.
Explanation:Cross-compilation with the javac
--targetflag is unsafe without also providing the corresponding standard library via-bootclasspathwhich changes to--systemin JDK >9 and is difficult to use, seehttps://bugs.openjdk.java.net/browse/JDK-8058150
However, JDKs >=9 also provide the
--releaseflag which bundles target platform and target standard library specification, seehttps://mail.openjdk.java.net/pipermail/jdk9-dev/2015-July/002414.html
This PR sets the corresponding property for the maven.compiler plugin and unsets it when JDK 1.8 is used for the build, because JDK 1.8 does not understand this flag.