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

Optionally disable loading gradle from gradle wrapper #917

Merged
merged 1 commit into from
May 14, 2019

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented May 8, 2019

Fixes #875
Requires eclipse-jdtls/eclipse.jdt.ls#1026

I have added two new properties: java.import.gradle.wrapper.enabled and java.import.gradle.version

Importing a gradle project works in the following way:

  • if there is gradlew and java.gradle.wrapper.enabled=true (default), the gradle wrapper distribution will be used
  • in the case that gradlew doesn't exist or java.import.gradle.wrapper.enabled=false, Java LS checks for the existence of the java.import.gradle.version property. If it exists, Java LS will use the required version
  • if there's no java.import.gradle.version property, Java LS checks for existence of the GRADLE_HOME env variable or the GRADLE_HOME system property. If it exists, Java LS will use the GRADLE_HOME local installation,
  • else Java LS will use default buildship version (5.0).

Signed-off-by: Snjezana Peco [email protected]

package.json Outdated
@@ -114,16 +114,22 @@
"description": "Traces the communication between VS Code and the Java language server.",
"scope": "window"
},
"java.import.gradle.enabled": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to keep java.import.gradle.enabled

package.json Outdated
"scope": "window"
},
"java.import.maven.enabled": {
"java.gradle.wrapper.enabled": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.import.gradle.wrapper.enabled

package.json Outdated
"description": "Enable/disable the Gradle wrapper.",
"scope": "window"
},
"java.gradle.version": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.import.gradle.version

@fbricon
Copy link
Collaborator

fbricon commented May 9, 2019

I think it makes more sense to check

  • use wrapper if enabled and present
  • else use gradle version if it is set and valid
  • else fall back to gradle home
  • else fall back to buildship default version

@snjeza
Copy link
Contributor Author

snjeza commented May 9, 2019

@fbricon I have updated the PR.

package.json Outdated
"java.import.gradle.version": {
"type": "string",
"default": null,
"description": "Gradle version.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle version, used if the gradle wrapper is missing or disabled.

README.md Outdated
@@ -109,6 +109,10 @@ The following settings are supported:
* `java.codeGeneration.toString.listArrayContents`: List contents of arrays instead of using native toString(). Defaults to `true`.
* `java.codeGeneration.toString.limitElements`: Limit number of items in arrays/collections/maps to list, if 0 then list all. Defaults to `0`.

*New in 0.45.0:*
* `java.import.gradle.wrapper.enabled`: Enable/disable the Gradle wrapper.
* `java.import.gradle.version`: Gradle version.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle version, used if the gradle wrapper is missing or disabled.

@snjeza
Copy link
Contributor Author

snjeza commented May 14, 2019

@fbricon I have updated the PR.

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

Successfully merging this pull request may close these issues.

Optionally disable loading gradle from gradle wrapper (request)
2 participants