The java.import.gradle.arguments setting is a No-Op #1169
Description
The Supported VS Code settings section of this project's Code page lists: „java.import.gradle.arguments: Arguments to pass to Gradle“. Disappointingly, setting that property's value to --gradle-user-home=<my.specified.location> has absolutely no effect. Likewise, setting its value to --refresh-dependencies has absolutely zero effect.
Environment
- Operating System: Windows amd64
- JDK version: OpenJDK 12
- Visual Studio Code version: 1.40.1 (system setup)
- Java extension version: 0.53.1
- Gradle 5.2.1 - 6.0.1
Steps To Reproduce
- Open a Gradle project
- Type
Ctrl + ,forSettings- enter
java.import.gradle.argumentsin theSettingsfield - select the
Workspacetab - enter
--gradle-user-home=<some.user.specified.location>in theArguments to pass to Gradle.field
- enter
- Do something that causes Gradle to execute a build. For instance...
Ctrl + Shift + B
- Observe that regardless of the value set for
--gradle-user-home, it is never used by Gradle.
Current Result
Regardless of the value set for java.import.gradle.arguments in vscode-java's Settings, the arguments given to it are never used by Gradle.
Expected Result
In the case of java.import.gradle.arguments being set to --gradle-user-home=<some.user.specified.location>, Gradle is expected to do the same thing it is documented to do when the same argument is passed to Gradle's command line interface. That is, Gradle should use the specified existing location. If the location given to --gradle-user-home does not exist already, then Gradle should automatically create it and then use that newly-created location.
Activity
fbricon commentedon Dec 3, 2019
might be a limitation of Buildship (or not). Can you check if this works as expected in Eclipse?
lingocoder commentedon Dec 3, 2019
Assuming the wizard in this screenshot is the way to set those properties for Eclipse...
...,then yeah, this screenshot of Eclipse shows what I would expect to see from setting that
--refresh-dependenciesargument in the above wizard and invoking Eclipse's/Buildship'sGradle — Refresh Gradle Projectcontext menu...I can confirm with total certainty that the above wizard's
Gradle user homefield does exactly what I expect too.hannah23280 commentedon Feb 29, 2020
Has this been solved? I also trying to set Gradle User home in VSCode , so that VSCode 's JAVA DEPENDENCIES section would display the correct paths (based on the value set in the Gradle User home) for the libraries listed under "Project and External Dependencies".
snjeza commentedon Mar 7, 2020
Related to #1310 and #1319
ob commentedon Mar 18, 2020
Is this issue resolved? I have a custom init script that we pass to
./gradlewwith the-Ioption:I tried adding the following to
.vscode/settings.json:but it doesn't seem to have any effect.
snjeza commentedon Mar 18, 2020
See #1310 (comment)
sarahcpage commentedon Sep 16, 2021
please fix this
jumble commentedon Nov 5, 2021
@snjeza Is there a path forward on this issue?
mozhuanzuojing commentedon Nov 5, 2021
@CsCherrYY please watch this .
It related by microsoft/vscode-gradle#1077
snjeza commentedon Nov 5, 2021
@jumble could you try to add the java.import.gradle.arguments property to User Settings?
mozhuanzuojing commentedon Nov 6, 2021
@snjeza After I tested, the gradle service failed to start
snjeza commentedon Nov 6, 2021
@mozhuanzuojing Could you try to set java.import.gradle.arguments instead of java.import.gradle.jvmArguments and attach your logs?
mozhuanzuojing commentedon Nov 7, 2021
@snjeza arguments is not effect. I think this parameter is not recognized by https://github.com/microsoft/vscode-gradle .
because
java.import.gradle.user.homeis ok.CsCherrYY commentedon Nov 8, 2021
Not sure If they're related, currently
vscode-javaandvscode-gradleare separate extensions andvscode-gradlewill consume some settings ofvscode-java. That's the only way the two extensions work together now, though we have a plan to reuse the daemons and so on.In the above discussion, I find vscode-gradle supports
java.import.gradle.jvmArgumentsonly, notjava.import.gradle.arguments.jumble commentedon Nov 10, 2021
I can partially verify @CsCherrYY 's above statement. Specifying values for
java.import.gradle.argumentsin user settings does not affect Java or Gradle execution.CsCherrYY commentedon Apr 14, 2022
With the newest extension (1.5.0), I can pass the arguments like
--gradle-user-homementioned viajava.import.gradle.argumentsand Gradle makes use of them successfully.