Skip to content

Commit 2de8859

Browse files
axtimwaldectrueden
andcommitted
Use --release flag to target intended JDK version
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. Co-authored-by: Curtis Rueden <ctrueden@wisc.edu>
1 parent 23b22e6 commit 2de8859

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

pom.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@
161161
<license.copyrightOwners>N/A</license.copyrightOwners>
162162

163163
<!-- Compiler configuration. -->
164-
<scijava.jvm.version>1.8</scijava.jvm.version>
164+
<scijava.jvm.version>8</scijava.jvm.version>
165165
<scijava.jvm.test.version>${scijava.jvm.version}</scijava.jvm.test.version>
166166
<!-- NB: 1.8.0_101 is needed for SciJava Maven repository HTTPS support. -->
167-
<scijava.jvm.build.version>[1.8.0-101,1.8.9999]</scijava.jvm.build.version>
167+
<scijava.jvm.build.version>[1.8.0-101,)</scijava.jvm.build.version>
168168
<maven.compiler.source>${scijava.jvm.version}</maven.compiler.source>
169169
<maven.compiler.target>${scijava.jvm.version}</maven.compiler.target>
170170
<maven.compiler.testSource>${scijava.jvm.test.version}</maven.compiler.testSource>
@@ -2015,5 +2015,14 @@
20152015
<scijava.platform.bits>32</scijava.platform.bits>
20162016
</properties>
20172017
</profile>
2018+
<profile>
2019+
<id>java-9</id>
2020+
<activation>
2021+
<jdk>[9,)</jdk>
2022+
</activation>
2023+
<properties>
2024+
<maven.compiler.release>${scijava.jvm.version}</maven.compiler.release>
2025+
</properties>
2026+
</profile>
20182027
</profiles>
20192028
</project>

0 commit comments

Comments
 (0)