Last active
March 2, 2020 07:51
-
-
Save shivam340/04d69c3a3754d3aeda41efda658819e7 to your computer and use it in GitHub Desktop.
Gradle project properties using ext closure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare properties using set(key,value) of ext. | |
project.ext.set("greetMessage", " Good Morning") | |
// declare properties inside ext closure | |
project.ext { | |
set("greetMessage", "Good Morning") | |
set("greetMessage2", "Good Afternoon") | |
} | |
// access a property using its key | |
println("${project.property("greetMessage")}") | |
// Project properties can be accessed via delegation | |
val greetMessage: String by project | |
// Print all project properties | |
println("gradle: In Root Project Printing all properties -------") | |
project.properties.forEach{ | |
println("Property key name: ${it.key} and value is : ${it.value}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment