From 4c568187344094431da25797b703bbd25a44c738 Mon Sep 17 00:00:00 2001 From: Johannes Feichtner <343448+Churro@users.noreply.github.com> Date: Tue, 17 Sep 2024 20:40:02 +0200 Subject: [PATCH] feat(gradle): use Java 21 with gradle >= 8.5 (#31449) --- lib/modules/manager/gradle-wrapper/util.spec.ts | 2 ++ lib/modules/manager/gradle-wrapper/utils.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/modules/manager/gradle-wrapper/util.spec.ts b/lib/modules/manager/gradle-wrapper/util.spec.ts index 63d730e59fe509..470adaf837d2b1 100644 --- a/lib/modules/manager/gradle-wrapper/util.spec.ts +++ b/lib/modules/manager/gradle-wrapper/util.spec.ts @@ -25,6 +25,8 @@ describe('modules/manager/gradle-wrapper/util', () => { ${'7.0.1'} | ${'^16.0.0'} ${'7.3.0'} | ${'^17.0.0'} ${'8.0.1'} | ${'^17.0.0'} + ${'8.5.0'} | ${'^21.0.0'} + ${'9.0.1'} | ${'^21.0.0'} `( '$gradleVersion | $javaConstraint', async ({ gradleVersion, javaConstraint }) => { diff --git a/lib/modules/manager/gradle-wrapper/utils.ts b/lib/modules/manager/gradle-wrapper/utils.ts index 04bc970ad23f92..fece660f4b0a16 100644 --- a/lib/modules/manager/gradle-wrapper/utils.ts +++ b/lib/modules/manager/gradle-wrapper/utils.ts @@ -60,6 +60,9 @@ export async function getJavaConstraint( return `^${toolChainVersion}.0.0`; } } + if (major > 8 || (major === 8 && minor && minor >= 5)) { + return '^21.0.0'; + } if (major > 7 || (major === 7 && minor && minor >= 3)) { return '^17.0.0'; }