maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adeelmahmood <>
Subject maven profiles - load based on environment
Date Thu, 28 Mar 2013 14:54:50 GMT
I am trying to setup maven profiles in a way that allows me to read a
properties file based on an environment property e.g. either or and then have those
propreties within the config-*.properties files available for the
application to use. I am kind of new to the maven profiles concept so I am
not sure what the best way is to set something up like this. This is how I
have things setup so far (following

-- Pom.xml





So first thing I have defined two profiles (dev and prod). Dev is active by
default and prod is activated based on WASENV environment variable/system
property/jndi entry (I am hoping). Then in the build section I am using
maven filtering to read the correct based on the activated
profile id. Also in the jetty configuration I am reading system properties
from the based on activated profile id. This works fine if
I run the app with jetty. If I run with jetty:run –P dev or –P prod, it
loads the correct profile and the correct file and
everything works.

However when I package it into a war file and deploy on tomcat, nothing
really happens (neither file is loaded). The fact is I am
not even sure how its supposed to work because maven is a build tool so if
the war is already built how can any of this activation of correct profile
will happen in tomcat based on environment variable. This is where I think I
am not sure how deployment based on profiles is supposed to work and can use
some help in understanding this better.

Any help would be appreciated.


View this message in context:
Sent from the Maven - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message