How to configure gradle to use mutiple environments and databases

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.

   <profile>
		<id>dev</id>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
		<properties>
		    <abc.mode>dev</abc.mode>
			<!-- Hibernate properties -->
			<hibernate.show_sql>false</hibernate.show_sql>
			<hibernate.format_sql>true</hibernate.format_sql>
		</properties>
	</profile>
	<profile>
		<id>postgresql</id>
		<properties>
			<jdbcDriver.groupId>postgresql</jdbcDriver.groupId>
			<jdbcDriver.artifactId>postgresql</jdbcDriver.artifactId>
			<jdbcDriver.version>8.3-603.jdbc4</jdbcDriver.version>
			<jdbcDriver.className>org.postgresql.Driver</jdbcDriver.className>
			<dataSource.url>jdbc:postgresql://localhost/test${abc.mode}</dataSource.url>
			<testDataSource.url>${dataSource.url}test</testDataSource.url>
		</properties>
	</profile>

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

https://plugins.gradle.org/plugin/net.saliman.properties

You can define the properties in gradle-.properties 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.