[GRADLE-2122] System property set on the command line (-D) does not override setting in gradle.properties Created: 23/Feb/12  Updated: 31/Mar/16  Resolved: 18/Feb/16

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.12-rc-1

Type: Improvement
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 3


 Description   

I have a project with a gradle.properties file that defines a system property for httpProxy.

systemProp.http.proxyHost=proxy

Is it still possible to overwrite that proxy with a -D command line parameter ?
I tried it but could not find a way to do so.

Thanks,
detlef



 Comments   
Comment by Jesper Thuun-Petersen.dk [ 26/Sep/13 ]

It's not possible to overwrite gradle.properties with a command line. In a lot of instances, this is a major limitation, and any command line parameter should preferably overwrite existing properties if present.

Comment by Stian L [ 16/May/14 ]

This does seem possible now, at least with gradle.properties in project root.

In gradle.properties:

org.gradle.configureondemand=true
org.gradle.parallel=true

If I run 'gradle build' I get the warning "Parallel execution with configuration on demand is an incubating feature.", but if I specify "-Dorg.gradle.configureondemand=false -Dorg.gradle.parallel=false" as arguments, no such warning is printed.

Comment by David Campos [ 01/Jul/14 ]

Gradle project properties can be overriden through -D or -P but system properties are immutable at this moment (Gradle 1.12)

Comment by Jacques Fulbert [ 31/Mar/16 ]

On a related but slightly different subject, when gradle depends on a maven project with a pom.xml that defines and use user defined properties (<properties>), does gradle -Dtheproperty=value will override its value like mvn -Dtheproperty=value would do? It seems to me it is not, but then how to override such value?

Generated at Wed Jun 30 12:13:23 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.