Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reopening a gradle project resets its gradle version #924

Closed
sallyur opened this issue May 15, 2019 · 7 comments · May be fixed by eclipse-jdtls/eclipse.jdt.ls#1041
Closed

Reopening a gradle project resets its gradle version #924

sallyur opened this issue May 15, 2019 · 7 comments · May be fixed by eclipse-jdtls/eclipse.jdt.ls#1041
Assignees

Comments

@sallyur
Copy link

sallyur commented May 15, 2019

Environment
  • Operating System: Mac
  • JDK version: 12.0.1
  • Visual Studio Code version: 1.33.1
  • Java extension version: RC bits 0.44.0-1521
Steps To Reproduce
  1. Open the project Test
  2. open a .java file to active the extension
Current Result

The generated files don't use my local gradle:
The gradle version in generated files:
image
My local gradle:
image
My settings is the default state:
image

Expected Result

The generated files use local gradle:
image

@fbricon
Copy link
Collaborator

fbricon commented May 15, 2019

@sallyur is this a regression?

@fbricon
Copy link
Collaborator

fbricon commented May 15, 2019

Works for me on my mac:

arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(LOCAL_INSTALLATION(/Users/fbricon/.sdkman/candidates/gradle/current))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=/Users/fbricon/.sdkman/candidates/gradle/current
java.home=/Users/fbricon/.sdkman/candidates/java/8.0.181-oracle
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true

Screen Shot 2019-05-15 at 3 58 26 PM

@fbricon
Copy link
Collaborator

fbricon commented May 15, 2019

I could reproduce the issue, and it was already present in vscode-java 0.44.0: when you import the project the 1st time, the proper buildship settings are generated, as per my previous comment.
When you reopen vscode, the settings are updated twice: the 1st time with the proper settings, and a few seconds later, they're wiped out, as in @sallyur's comment, and a different gradle version is used.
My guess is we don't properly trigger the gradle update, somehow.

@fbricon fbricon added the bug label May 15, 2019
@fbricon fbricon changed the title Can't use gradle env variable on Mac Reopening a gradle project resets its gradle version May 15, 2019
@fbricon
Copy link
Collaborator

fbricon commented May 15, 2019

so more specifically the problem occurs after cleaning the server directory. The project already has local eclipse config files, this seems to confuse the import.

@Harvtronix
Copy link

I believe I'm encountering this issue in my local environment. Even if I manually set the gradle distribution version in the prefs file, it gets reset for at least one of the projects in my workspace as soon as I clear the language server. Seems to be getting set to a version much newer than I have installed locally, and also much newer than the wrapper governing the rest of the workspace projects. Is there any workaround for this issue while the PR is under review?

@wxlfrank
Copy link

wxlfrank commented Nov 25, 2020

I have the same problem.

installed gradle version 6.7 but 6.3 is used in the .gradle folder.

Extension Name: vscode-java
Extension Version: v3.5.2
OS Version: macOS Big Sur Version 11.0.1
VSCode version: 1.51.1

Describe the bug
I installed gradle 6.7 and use gradle init to create a gradle project
but in vscode, the .gradle folder contains both 6.3 and 6.7 subfolders.

If I run the gradle init command in terminal, there is only one subfoler, 6.7, in the .gradle folder

I also found in the buildOutputCleanup folder, the cache.properties file has gradle.version=6.3
where does this gradle.version property come from?

The subfolder 6.7 is created by vscode-gradle extenstion
The subfolder 6.3 is created by vscode-java extension

To Reproduce

  • mkdir test && cd test
  • gradle init
  • code .

Expected behavior
gradle project should has no problem in vscode

@jdneo
Copy link
Collaborator

jdneo commented Jul 5, 2021

Tried with 0.80.0, the problem seems has been fixed @testforstephen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants