Skip to content

Commit 7143520

Browse files
maigovannongae-java-bot
authored andcommitted
Enabling Maven profiles for JDK21 and JDK25. Separate builds can be enabled on for these using a simple
``` mvn clean install -P<jdk21/jdk25> ``` This assumes that there are explicit `JAVA_HOME_21` and `JAVA_HOME_25` which are set. PiperOrigin-RevId: 797843586 Change-Id: Id7dd6c8b01922f3124efc4cbfa1cbcf78ef00830
1 parent 2485f3b commit 7143520

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/maven.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ jobs:
3333
os: [ubuntu-latest]
3434
java: [17, 21, 25-ea]
3535
jdk: [temurin]
36+
include:
37+
- java: 17
38+
maven_profile: ""
39+
- java: 21
40+
maven_profile: "-Pjdk21"
41+
- java: 25-ea
42+
maven_profile: "-Pjdk25"
3643
fail-fast: false
3744

3845
runs-on: ${{ matrix.os }}
@@ -48,7 +55,15 @@ jobs:
4855
java-version: ${{ matrix.java }}
4956
cache: 'maven'
5057

58+
- name: Set JAVA_HOME for specific versions
59+
run: |
60+
if [[ "${{ matrix.java }}" == "21" ]]; then
61+
echo "JAVA_HOME_21=$JAVA_HOME" >> $GITHUB_ENV
62+
elif [[ "${{ matrix.java }}" == "25-ea" ]]; then
63+
echo "JAVA_HOME_25=$JAVA_HOME" >> $GITHUB_ENV
64+
fi
65+
5166
- name: Build with Maven
5267
run: |
53-
./mvnw clean install -B -q
68+
./mvnw clean install -B -q ${{ matrix.maven_profile }}
5469
echo "done"

pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,44 @@
205205
</repository>
206206
</repositories>
207207
</profile>
208+
<profile>
209+
<id>jdk21</id>
210+
<properties>
211+
<maven.compiler.release>21</maven.compiler.release>
212+
<maven.compiler.source>21</maven.compiler.source>
213+
<maven.compiler.target>21</maven.compiler.target>
214+
</properties>
215+
<build>
216+
<plugins>
217+
<plugin>
218+
<groupId>org.apache.maven.plugins</groupId>
219+
<artifactId>maven-compiler-plugin</artifactId>
220+
<configuration>
221+
<executable>${env.JAVA_HOME_21}/bin/javac</executable>
222+
</configuration>
223+
</plugin>
224+
</plugins>
225+
</build>
226+
</profile>
227+
<profile>
228+
<id>jdk25</id>
229+
<properties>
230+
<maven.compiler.release>25</maven.compiler.release>
231+
<maven.compiler.source>25</maven.compiler.source>
232+
<maven.compiler.target>25</maven.compiler.target>
233+
</properties>
234+
<build>
235+
<plugins>
236+
<plugin>
237+
<groupId>org.apache.maven.plugins</groupId>
238+
<artifactId>maven-compiler-plugin</artifactId>
239+
<configuration>
240+
<executable>${env.JAVA_HOME_25}/bin/javac</executable>
241+
</configuration>
242+
</plugin>
243+
</plugins>
244+
</build>
245+
</profile>
208246
</profiles>
209247

210248
<dependencyManagement>

0 commit comments

Comments
 (0)