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 #1026

Merged
merged 1 commit into from
May 14, 2019

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented May 8, 2019

@snjeza
Copy link
Contributor Author

snjeza commented May 9, 2019

@fbricon I have updated the PR.

if (gradleHomeFile != null) {
distribution = GradleDistribution.forLocalInstallation(gradleHomeFile);
if (JavaLanguageServerPlugin.getPreferencesManager() != null && JavaLanguageServerPlugin.getPreferencesManager().getPreferences().isGradleWrapperEnabled() && Files.exists(rootFolder.resolve("gradlew"))) {
return DEFAULT_DISTRIBUTION;
Copy link
Contributor

Choose a reason for hiding this comment

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

that should be GradleDistribution.fromBuild()

@@ -185,7 +201,7 @@ private static boolean checkGradlePersistence(boolean shouldSynchronize, IProjec

@Override
public boolean accept(File dir, String name) {
if (name != null && name.endsWith(GradleBuildSupport.GRADLE_SUFFIX)) {
if (name != null && (name.endsWith(GradleBuildSupport.GRADLE_SUFFIX) || name.equals(".settings"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

*/
public static final String GRADLE_WRAPPER_ENABLED = "java.import.gradle.wrapper.enabled";
/**
* Preference key for gradle version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Preference key for gradle version to use when the gradle wrapper is not used.

@@ -540,6 +557,11 @@ public Preferences setJavaHome(String javaHome) {
return this;
}

public Preferences setGradleVersion(String gradleVersion) {
this.gradleVersion = gradleVersion;
Copy link
Contributor

Choose a reason for hiding this comment

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

if null or blank, then assign null

Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
@snjeza
Copy link
Contributor Author

snjeza commented May 14, 2019

@fbricon I have updated the PR.

@snjeza
Copy link
Contributor Author

snjeza commented May 14, 2019

test this please

@fbricon fbricon merged commit 13ec1ad into eclipse-jdtls:master May 14, 2019
@fbricon fbricon added this to the Mid May 2019 milestone May 15, 2019
@fbricon
Copy link
Contributor

fbricon commented May 15, 2019

Two new properties are added: 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).

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

Successfully merging this pull request may close these issues.

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