James Carr wrote:
>
> It's well known that passing -Pfoo=bar will create a variable named
> foo equal to "bar" in a gradle file... but how can I set this to be
> defaulted to a value if it is not specified?
>
Before first use of the variable in the build script, do:
if (!hasProperty("foo")) foo = "default value"
'hasProperty' is a method on class org.gradle.api.Project.
--
Peter Niederwieser
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradleware
http://www.gradleware.com
Creator, Spock Framework
http://spockframework.org
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Defaulting-value-that-can-be-overridden-from-the-commandline-tp4359618p4359771.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email