microsoft / vscode-gradle

Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle
MIT License
124 stars 51 forks source link

Gradle for Java v3.13.5 not suport gradle 4.10.3 #1492

Closed internetafei closed 4 months ago

internetafei commented 4 months ago

Extension Name: vscode-gradle Extension Version:v3.13.5 OS Version: macos 14.4.1 (23E224) VSCode version: version 1.85

Describe the bug My gradle 's version info flow


Gradle 4.10.3

Build time: 2018-12-05 00:50:54 UTC Revision: e76905e3a1034e6f724566aeb985621347ff43bc

Kotlin DSL: 1.0-rc-6 Kotlin: 1.2.61 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 1.8.0_391 (Oracle Corporation 25.391-b13) OS: Mac OS X 14.4.1 aarch64

My vscode settings.json context

"java.import.gradle.home": "/opt/gradle4", "gradle.nestedProjects": true, "java.import.gradle.wrapper.enabled": false, "java.import.gradle.java.home": " /opt/jdk-17.0.9.jdk/Contents/Home",

Error info: BUILD FAILED in 0s [error] Error getting build for /Volumes/myData/myproject/testGradle: Could not run build action using connection to Gradle installation '/opt/gradle4'. [info] Found 0 tasks [error] [gradle-server] Could not run build action using connection to Gradle installation '/opt/gradle4'. [info] Build file opened: /Volumes/myData/myproject/testGradle/build.gradle

Expected behavior gradle for java support gradle4.10

Output from "Gradle for Java" FAILURE: Build failed with an exception.

BUILD FAILED in 0s [error] [gradle-server] Could not run build action using connection to Gradle installation '/opt/gradle4'. [error] Error getting build for /Volumes/myData/myproject/testGradle: Could not run build action using connection to Gradle installation '/opt/gradle4'. [info] Found 0 tasks [info] Java Home: /opt/jdk1.8.0_391.jdk/Contents/Home [info] JVM Args: -XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant [info] Gradle User Home: /Users/lpf/.gradle [info] Gradle Version: 4.10.3 [info] CONFIGURE SUCCESSFUL in 0s

FAILURE: Build failed with an exception.

BUILD FAILED in 0s [error] Error getting build for /Volumes/myData/myproject/testGradle: Could not run build action using connection to Gradle installation '/opt/gradle4'. [info] Found 0 tasks [error] [gradle-server] Could not run build action using connection to Gradle installation '/opt/gradle4'. [info] Build file opened: /Volumes/myData/myproject/testGradle/build.gradle

Does the bug still exist if you disable all other extensions? No verification

Additional context I tried Gradle8.2, it's normal

jdneo commented 4 months ago

You've set the java.import.gradle.java.home to jdk 17. According to the compatibility matrix, gradle 4 does not support jdk17: https://docs.gradle.org/current/userguide/compatibility.html

internetafei commented 4 months ago

I tried jdk8 but there were also issues, and later I switched to jdk17

internetafei commented 4 months ago

I don't know if it's related to macos M1

jdneo commented 4 months ago

What will happen if you set java.import.gradle.home to empty and set java.import.gradle.version to sth like 4.3?