How do I build different versions of an EAR using different property files (or substitutions)?

I need to build multiple versions of an EAR, each with different properties of property substitutions. I need to specify different configuration details, for example different database login credentials in dev vs production.

Maven has a filter mechanism that substitutes different replacement values. Here’s a doc describing the process: [https://developer.jboss.org/wiki/HowToConfigureJavaEEApplicationToApplyDifferentSettingsinWebxmlEtcForVariousEnvironmentsByMaven].

Does Gradle have a similar mechanism? Or is there another way I can accomplish the same outcome?

For reference, I’m using Gradle v2.1 and I have a java based multi project setup where I build an EAR from the root Gradle script that includes multiple WAR files, built from sub-projects, each with their own Gradle script.

Thanks.

Create a secondary Ear task to create another ear. Make sure that the output file name is modified to prevent replacing the file from the default Ear task. If you have a lot of common configurations between the two you can create a common closure that is applied to both tasks with the ‘configure’ method.