My team has `org.gradle.jvmargs= -Xmx12g -Xms4g` ...
# community-support
c
My team has
org.gradle.jvmargs= -Xmx12g -Xms4g
set in our android project in the gradle.properties for the repo. Can I override that easily without having to commit those changes to my entire team? I'd love to bump the 12g down to 6g. Everything I'm reading basically says that the project ones will take pretty much the highest priority, but that seems weird as if theres no way to update it to my personal prefs without affecting the whole team
t
I usually put those types of just for me changes into a do not commit change list
m
I drop those type of changes in my global ~/.gradle/gradle.properties file
Copy code
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx4g
Then the settings are universal on my machine. I never have to remember for git checkout.
2
m
Newer documentation, from at least 8.9, maybe earlier, states what you said, but older documentation, e.g. 8.6, says user properties take precedence. I don't think this was a change in behaviour, but a mistake when rewriting the documentation. I'd be very surprised if such a change slipped by unnoticed, and it does not make any sense, either.
t
If I read that correctly, user properties have precedence over project properties, so the current doc is correct: https://github.com/gradle/gradle/blob/9f8190382f9e23e530daefd35070638e8edbfdea/sub[…]/gradle/initialization/DefaultGradlePropertiesLoaderTest.groovy (also, to me, both docs linked above say the same thing: $GRADLE_USER_HOME/gradle.properties takes precedence over $PROJECT/gradle.properties which takes precedence over $GRADLE_HOME/gradle.properties)
m
You're absolutely right, of course! I misunderstood the "System properites / Project Root Dir" combination in the table.
Though the location column for "Gradle properties" could be improved, as it only very implicitly states the precedence.
c
waiiit... so global ~/.gradle/gradle.properties file does take precendence over the ones baked into the project? both 8.9 and 8.6 docs to me say that the props in the project will take precendence.
t
I admit learning about this myself only a couple weeks ago! But the docs are clear (well, sort of 😅): command line over system properties over gradle properties over environment variables (https://docs.gradle.org/8.9/userguide/build_environment.html#priority_for_configurations), and for gradle properties, ~/.gradle/gradle.properties over project root dir's gradle.properties over Gradle distribution's gradle.properties (https://docs.gradle.org/8.9/userguide/build_environment.html#sec:gradle_configuration_properties) Note that this is relatively clear for gradle properties, much less so for project properties (https://docs.gradle.org/8.9/userguide/build_environment.html#sec:project_properties), but at that point I'm not even sure what "project properties" really are and whether they're useful (e.g. ProviderFactory only exposes gradle properties and system properties, not project properties; repository credentials look at gradle properties, not project properties) …and yet I'm almost certain I've used
-PfooUsername=
to set repository credentials and it worked, whereas according to the docs I should have probably used `-DfooUsername=`; I think maybe
providers.gradleProperty()
even returns so-called project properties (set with
-P
) so this is very blurry…. (I admit not doing any experimentation before writing this though)
c
@Thomas Broyer "for gradle properties, ~/.gradle/gradle.properties over project root dir's gradle.properties" that's not what this chart (from your first link) says?
Maybe I'm misunderstanding $GRADLE_USER_HOME and $GRADLE_HOME
m
@Colton Idle I think that's what the chart says.
~/.gradle
is the default for
$GRADLE_USER_HOME
, and one way to read the Location cell of Priority 3 is that this has precedence over Project root dir which in turn has precedence over
$GRADLE_HOME
(which is the gradle distribution, but IIRC only possible if you use a custom one)
👆 1
t
This is made clearer in the section specific to gradle properties: https://docs.gradle.org/8.9/userguide/build_environment.html#sec:gradle_configuration_properties
image.png
c
ah yes. much clearer there. thank you all. i thought i was going crazy, but indeed its a bit muddy in the docs. WOO. glad i can set this globally and avoid the 12G that is set on the project on the project level. lol