I want to write a gradle build script, which works in different environments (development, live). In each environment I have to load different property sets (target directories, databases, etc.).
Is there a gradle way to read a property file dependent on the environment or a profile?
You may want to check out the Gradle Properties Plugin.
Include plugin:
plugins {
id 'net.saliman.properties' version '1.4.2'
}
Create property files:
gradle-dev.properties
or
gradle-prod.properties
Call gradle:
gradle myTask -PenvironmentName=dev
gradle myTask -PenvironmentName=prod
Also have a look at gradle's equivalent of maven's profiles.
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