properties - Gradle - Fails to show: org.gradle.java.home -
i thought simple thing. far i'm unable access string gradle job's java.home, official name:
- for example, see: org.gradle.java.home
apparently can set value gradle.properties settings file. i've done , gradle output confirms this.
for that, none of these print statements work...
- print "org.gradle.java.home = $org.gradle.java.home"
- print "org.gradle.java.home = "+ project.properties['org.gradle.java.home']
- print "org.gradle.java.home = $gradle.java.home"
- print "${project.property('org.gradle.java.home')}"
looking @ @ this question, have thought 1 of options tried yield result.
how can access system level properties?
only 2 options may work:
print "org.gradle.java.home = "+ project.properties['org.gradle.java.home']
print "${project.property('org.gradle.java.home')}"
and second fail since there's no checking if such property exists. gradle throws exception on access non-existing property.
the last 2 not work because there's no property org , gradle objects has no java property - more explanation can found here - need understand how string interpolation works groovy.
and finally, these properties used pass arguments gradle. following work:
print "org.gradle.java.home = "+
project.properties['org.gradle.java.home']
run with:
gradle -dorg.gradle.java.home=random_dir
Comments
Post a Comment