Current API (Gradle 1.10) provides method project.property(name)
(which throws exception when property is not defined anywhere), but does not provide method project.property(name, defaultValue)
.
In case when configuration property is optional and has default value, I always has to write
def value
if( project.hasProperty('name') )
value = project.property('name');
else
value = 'defaultValue';
For the first this is inconvenient boilerplate code, and for the second - it causes double evaluation of the property when it does exist somewhere in evaluation chain - and this is unneeded CPU load and repetitive evaluation latency.