groovy - How to use gradle properties in build.gradle -


when run task:

task tmptask << {     project.properties.each {println "   $it"} } 

i see:

org.gradle.java.home=/usr/lib/jvm/java-6-oracle 

but how use variable? i've tried both:

task tmptask << {     println org.gradle.java.home     println project.properties.org.gradle.java.home } 

but none of works. first print gives error:

could not find property 'org' on task ':tmptask'. 

while second fails with:

cannot property 'gradle' on null object 

project.properties map<string, ?>

so can use

project.properties['org.gradle.java.home'] 

you can use property() method (but looks in additional locations):

project.property('org.gradle.java.home') 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -