In a gradle task I can create a path like this:
System.env.FOLDER_PATH + '/subFolder'
but I would like to set this in my gradle.properties instead, so it would be something like
subFolderPath=${System.env.FOLDER_PATH}/subFolder
but I can't find any examples of this, is it even possible?
Gradle can also set project properties when it sees specially-named system properties or environment variables. If the environment variable name looks like ORG_GRADLE_PROJECT_prop=somevalue , then Gradle will set a prop property on your project object, with the value of somevalue .
Local variables are declared with the def keyword. They are only visible in the scope where they have been declared. Local variables are a feature of the underlying Groovy language. Local variables are declared with the val keyword.
Environment variables are needed to customise the execution of the gradle tasks. Below is the working code in gradle 7.3.
gradle.properties
is a plain Java properties file. It can only contain literal key/value pairs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With