maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Paynter <kittl...@gmail.com>
Subject Re: how to centralize configuration accross multiple modules
Date Tue, 05 Oct 2010 17:07:10 GMT
For property values -- I setup a .properties file for each of our
environments with the default being 'dev'.  So for a default build, the dev
properties are used.  but when its time to build for QA or Production, you
add a cmd line argument accordingly:   mvn install -DenvType=QA

So I something like this in my top level pom:
<properties>
    <envType>dev</envType> <!-- Default Environment value -->
    <PomRoot> path to root pom </PomRoot>
   ....

and then use:
<build>
    <filters>
      <filter>${PomRoot}/${envType}Config.properties</filter>
    </filters>

Then create:
devConfig.properties
qaConfig.properties
... or whatever environment names you need

This lets me use environment specific properties anywhere in the build.  It
works quite well.

On Tue, Oct 5, 2010 at 5:57 AM, Jesse Farinacci <jieryn@gmail.com> wrote:

> Hi Emerson,
>
> On Tue, Oct 5, 2010 at 8:50 AM, emerson <echofloripa.yell@gmail.com>
> wrote:
> >
> > I would like then to pass a parameter to the mvn command (eg. mvn
> -Denv=st1)
> > and it would pick up the appropriate resource file depending on the
> > environment.
> > What would be the best way to implement something on these lines?
>
> You should look at
> http://maven.apache.org/plugins/maven-remote-resources-plugin/ .. you
> could bundle them up in one module, and extract them (via
> property-enabled profile) wherever needed. Then your integration tests
> just need to pick up your properties bundle.
>
> -Jesse
>
> --
> There are 10 types of people in this world, those
> that can read binary and those that can not.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message