You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ian Petzer <ia...@gmail.com> on 2007/05/17 12:28:06 UTC

Build time resolution of properties files

Hi,

I'm trying to build a WAR which includes a properties file at build
time. This properties file will vary according to the environment that
it is being built for. (dev, test, prod). This would ideally be added
during something like the process-resources stage, so that I can point
my eclipse project at various environments.

I've tried adding profiles to the project which specify an additional
resource area where the property file can be pulled from. ie
(src/main/properties/dev and src/main/properties/test).

This works fine the first time I build my war and the correct
properties file for the profile is included. However when I try to do
it again with a different profile, the properties file is not
replaced. Instead the properties file (from the previous build) is
incorporated into the build.

The only way to get it to work properly every time is to run mvn clean
every time.

At the moment, I've figured out another way where I use the ant runner
to copy the desired properties file into src/main/resources.

Is there a better way for me to do this.

ps: The properties files all have the same name, but thats necessary
as the application picking them up has this name hard-coded into its
config.

Thanks,
Ian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org