Vscode-java: Optionally disable loading gradle from gradle wrapper (request)

Created on 9 Apr 2019  路  6Comments  路  Source: redhat-developer/vscode-java

It would be nice to be able to either optionally disable loading gradle from the gradle wrapper and always using system gradle (if higher then 2.6) so in cases where the gradle project is using a wrapper with a version < 2.6 the java plugin can still function.

Environment
  • Operating System: Mac OSX High Sierra
  • JDK version: 1.8
  • Visual Studio Code version: 1.32.3
  • Java extension version: 0.42.1
Steps To Reproduce
  1. Have gradle > 2.6 on path
  2. Have a gradle project that uses the wrapper with gradle < 2.6 (ex: 1.12)
  3. Redhat plugin complains about not being able to use the plugin with gradle < 2.6
Current Result

Can't use downstream plugins (checkstyle/run tests)

Wanted Result

Redhat plugin can optionally use system gradle always to at least allow some functionality on gradle 1.12 projects that use the wrapper

Additional Informations

I found this out while initially developing a project where it did not have the gradle wrapper with my gradle 5 system gradle version. I was able to run/debug tests and use checkstyle with no problems. I then added the wrapper, to find that afterwards i could not do either of these things because my gradle version (in the wrapper) was too low.

Gradle enhancement

Most helpful comment

maybe also "java.gradlePath" ?!
"java.gradlePath": "system" //use global installed gradle
"java.gradlePath": "wrapper" //use workspace gradle wrapper
"java.gradlePath": "C:/Gradle/gradle-5.2.1" //use custom gradle path

All 6 comments

Shouldn't be too difficult to implement

maybe also "java.gradlePath" ?!
"java.gradlePath": "system" //use global installed gradle
"java.gradlePath": "wrapper" //use workspace gradle wrapper
"java.gradlePath": "C:/Gradle/gradle-5.2.1" //use custom gradle path

//i'm edited comment

gradle path can be specified in "${opened folder}/.settings/org.eclipse.buildship.core.prefs", in line connection.gradle.distribution= set GRADLE_DISTRIBUTION(LOCAL_INSTALLATION(PATH_TO_GRADLE)) for using global gradle (or custom gradle path), or GRADLE_DISTRIBUTION(WRAPPER) for using wrapper in your folder

@SupinePandora43 you can try the following property:

"java.jdt.ls.vmargs": "-DGRADLE_HOME=C:/Gradle/gradle-5.2.1 -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication",

@snjeza i don't need that, i configured gradle java home in gradle.properties, gradle path (WRAPPER) in .pref file. because minecraft forge dont support versions newer gradle 4.9, java 10. i'm got jdk 12 and jdk 8, gradle 5.2.1 and 4.9.0

Was this page helpful?
0 / 5 - 0 ratings