From 9c5c98c17a3d510305c349405dd326bc62d96005 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Wed, 18 Oct 2023 16:39:26 +0800 Subject: [PATCH] fix: Fallback to 7.4.2 when creating gradle connector --- .../java/bs/core/internal/gradle/GradleBuildKind.java | 6 +++++- .../microsoft/java/bs/core/internal/gradle/Utils.java | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/GradleBuildKind.java b/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/GradleBuildKind.java index e86d8f8e..9a7590e0 100644 --- a/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/GradleBuildKind.java +++ b/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/GradleBuildKind.java @@ -22,5 +22,9 @@ public enum GradleBuildKind { /* * From the used TAPI. */ - TAPI; + TAPI, + /** + * Temporarily fallback to the default Gradle version used by Buildship (7.4.2). + */ + FALLBACK; } diff --git a/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/Utils.java b/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/Utils.java index d88c0eb0..3fcb33fb 100644 --- a/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/Utils.java +++ b/server/src/main/java/com/microsoft/java/bs/core/internal/gradle/Utils.java @@ -43,6 +43,8 @@ private Utils() {} */ private static final String GRADLE_USER_HOME = "GRADLE_USER_HOME"; + private static final String DEFAULT_BUILDSHIP_GRADLE_VERSION = "7.4.2"; + /** * Get the Gradle connector for the project. * @@ -74,6 +76,9 @@ public static GradleConnector getProjectConnector(File project, Preferences pref case SPECIFIED_INSTALLATION: connector.useInstallation(getGradleHome(preferences.getGradleHome())); break; + case FALLBACK: + connector.useGradleVersion(DEFAULT_BUILDSHIP_GRADLE_VERSION); + break; default: connector.useBuildDistribution(); break; @@ -247,6 +252,8 @@ public static GradleBuildKind getEffectiveBuildKind(File projectRoot, Preference return GradleBuildKind.SPECIFIED_INSTALLATION; } - return GradleBuildKind.TAPI; + // TODO: Once we figure out why TAPI fails a lot, we can enable it. + // return GradleBuildKind.TAPI; + return GradleBuildKind.FALLBACK; } }