I have a Java EE 6 app that I build with Maven, code in NetBeans 7 and deploy on GlassFish 3.1.2. As I near completion, I find myself deploying demo builds.
The problem is that I don't have any dead easy way to build for different environment such as dev, QA, demo, prod, etc. For some stuff, I've been using a Java class with a bunch of static getters that return values based on the value of an environment constant. But this doesn't help me with conditionally setting
- javax.faces.PROJECT_STAGE (web.xml)
- database credentials (glassfish-resources.xml)
- mail servers (glassfish-resources.xml)
- JPA logging level (persistence.xml)
and probably a number of other things I can't think about now that are scattered across XML files.
Is there any way to define multiple versions of these configuration files and just set a flag at build time to select the environment, while defaulting to dev when no environment is specified? Is there a way I could make Maven work for me in this instance?