redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 440 forks source link

Upgrading gradle wrapper doesn't work for a specific project #3198

Open yuyully opened 1 year ago

yuyully commented 1 year ago
Environment
Steps To Reproduce
  1. Set java.import.gradle.java.home as jdk17
  2. Clone and open https://github.com/oblac/jodd.git
  3. When it prompts that if upgradle gradle or update jdk, select 'Upgrade Gradle to 7.4.2'
Current Result

Upgrading gradle wrapper doesn't work for this project. However it can work fine for other projects. jodd

Expected Result

Can upgrade gradle wrapper successfully.

snjeza commented 1 year ago

The jod project requires the Gradle Wrapper version 6.4 - https://github.com/oblac/jodd/blob/master/build.gradle#L498 @v-yuyul If you want to upgrade to the 7.4.2 version you can use the following patch:

diff --git a/build.gradle b/build.gradle
index cc306ff08..363e4db43 100644
--- a/build.gradle
+++ b/build.gradle
@@ -495,5 +495,5 @@ static def date() {
 // --- wrapper ----------------------------------------------------------------

 wrapper {
-   gradleVersion = '6.4'
+   gradleVersion = '7.4.2'
 }

or

diff --git a/build.gradle b/build.gradle
index cc306ff08..e8c5b3c7a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -491,9 +491,3 @@ static def date() {
        def formattedDate = date.format('yyyyMMdd')
        return formattedDate
 }
-
-// --- wrapper ----------------------------------------------------------------
-
-wrapper {
-       gradleVersion = '6.4'
-}
yuyully commented 1 year ago

Thanks for your comments, @snjeza . It can be upgraded following you steps. But is there any possible to improve the experience? It keeps prompting to upgrade wrapper but actually it's unable to upgrade without manual step, which I don't think it's a good experience.