Skip to content

Commit 991e3d0

Browse files
Add build profile for JDK14+ #2709 (#2829)
With the support of Java records, a Maven build profile has been introduced to Java 14 language and preview features. This was done in 2.12 branch, just porting it back to master as records are supported there too.
1 parent 3124dde commit 991e3d0

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

pom.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,57 @@
225225
<skipTests>true</skipTests>
226226
</properties>
227227
</profile>
228+
<profile>
229+
<!-- Build Record tests using Java 14 if JDK is available -->
230+
<id>java14+</id>
231+
<activation>
232+
<jdk>[14,</jdk>
233+
</activation>
234+
<build>
235+
<plugins>
236+
<plugin>
237+
<groupId>org.codehaus.mojo</groupId>
238+
<artifactId>build-helper-maven-plugin</artifactId>
239+
<executions>
240+
<execution>
241+
<id>add-test-source</id>
242+
<phase>generate-test-sources</phase>
243+
<goals>
244+
<goal>add-test-source</goal>
245+
</goals>
246+
<configuration>
247+
<sources>
248+
<source>src/test-jdk14/java</source>
249+
</sources>
250+
</configuration>
251+
</execution>
252+
</executions>
253+
</plugin>
254+
<plugin>
255+
<groupId>org.apache.maven.plugins</groupId>
256+
<artifactId>maven-compiler-plugin</artifactId>
257+
<inherited>true</inherited>
258+
<configuration>
259+
<optimize>true</optimize>
260+
<!-- Enable Java 14+ for all sources so that Intellij picks the right language level -->
261+
<source>14</source>
262+
<release>14</release>
263+
<compilerArgs>
264+
<arg>-parameters</arg>
265+
<arg>--enable-preview</arg>
266+
</compilerArgs>
267+
</configuration>
268+
</plugin>
269+
<plugin>
270+
<groupId>org.apache.maven.plugins</groupId>
271+
<artifactId>maven-surefire-plugin</artifactId>
272+
<configuration>
273+
<argLine>--enable-preview</argLine>
274+
</configuration>
275+
</plugin>
276+
</plugins>
277+
</build>
278+
</profile>
228279
</profiles>
229280

230281
</project>

0 commit comments

Comments
 (0)