How to configure gradle to use mutiple environments and databases


(Mishra) #1

i have to covert the profiles and properties of maven to Gradle.
in below pom given values are dev environment and db as postgresql and it will run
mvn install -Pdev,postgresql. How do i convert the same in gradle. actually the POM consist two (dev,sit) environmnet and 3 Database.

			<!-- Hibernate properties -->

(Alexander Volanis) #2

Given that you only seem to use the Maven profiles to adjust/inject sets of properties you can accomplish pretty much the same using this Gradle plugin

You can define the properties in files in the root of your projects and select them by using gradle -PenvironmentName=<profileName>

The plugin allows to “rename” the property name environmentName to another unique but suitable name if you so desire so you could end up with a convenient -Pprofile=foo syntax if you are inclined to do so.