gradle.xml gradleHome - How is this populated?

已回答

Hello

My gradle.xml file looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/local/Cellar/gradle/5.5.1/libexec" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

In debugging something else, I noticed that this file contains a reference to what looks like a brew-installed version of Gradle 5.5. I checked, and I did in fact have a Gradle install at this location. I uninstalled it via brew since we use a much newer version of Gradle. The /usr/local/Cellar/gradle/ directory no longer exists. My project is configured to use Gradle from the 'gradle-wrapper.properties' file, which specifies a version of 6.8.3. My understanding -- and correct me if I'm wrong -- is that gradleHome is supposed to be derived from whatever is specified in gradle-wrapper.properties. Now, if I wipe out my .idea folder and reload the project, it still generates a gradle.xml file containing this reference to /usr/local/Cellar/gradle/5.5.1/libexec. My question is, how is this gradle.xml file being generated? Where is it getting this directory from?

Thanks,

-- Cam

0

This value will be used when you switch to Specified location in the IDE Gradle settings:

You can change this value by switching to this option, changing it and saving the configuration.

0

This is what I find interesting. I have it configured such that gradle-wrapper.properties is used:

We only have one gradle-wrapper.properties file in our project:

which contains

This continually happens even after invalidating indexes, clearing file system caches, deleting the .idea folder, etc.. gradle.xml is always re-created referencing that 5.5.1 version of gradle.

0

What I was trying to say is the this value you see in xml file is not actually used when you use gradle-wrapper.properties. But it will be used if you switch it to local Gradle distribution. So this is the expected configuration file content.

0

Ah ok. I see. So I can ignore the contents of gradle.xml and trust that IntelliJ is using the properties file if I've configured it to do so.

Thank you!

0

请先登录再写评论。