Skip to content

Commit 0867ec9

Browse files
committed
Use maven.compiler.release to control build targets under Java 9 and newer
1 parent 1c1e540 commit 0867ec9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pom.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
<properties>
4343
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4444

45+
<!-- For Java 8; Java 9 and newer will pay attention to maven.compiler.release, specified in a Java-9-and-later
46+
profile -->
47+
<maven.compiler.source>8</maven.compiler.source>
48+
<maven.compiler.target>8</maven.compiler.target>
49+
4550
<jmh.version>1.32</jmh.version>
4651
<junit.version>5.8.1</junit.version>
4752
</properties>
@@ -112,10 +117,6 @@
112117
<groupId>org.apache.maven.plugins</groupId>
113118
<artifactId>maven-compiler-plugin</artifactId>
114119
<version>3.8.1</version>
115-
<configuration>
116-
<source>1.8</source>
117-
<target>1.8</target>
118-
</configuration>
119120

120121
<executions>
121122
<execution>
@@ -236,6 +237,16 @@
236237
</build>
237238

238239
<profiles>
240+
<profile>
241+
<id>java-8-release-target</id>
242+
<activation>
243+
<jdk>[9,)</jdk>
244+
</activation>
245+
<properties>
246+
<maven.compiler.release>8</maven.compiler.release>
247+
</properties>
248+
</profile>
249+
239250
<profile>
240251
<id>release-sign-artifacts</id>
241252
<activation>

0 commit comments

Comments
 (0)