Thanks all for the comments.  If there is a better way to do what I need,
then I welcome help to understand how to do it right.

We have configurations we need to load for the various development and
testing environments (unit and integration).

I've been working to put the specific configuation information for each
environment (URL's, IP's, debug levels, etc.) into property files.  Each
property file will have a name like "test.properties" or
"staging.properties".   There is a 1 to 1 mapping between a maven profile
and each properties file.  (e.g., profile.id = "staging" loads
"staging.properties")

As I understand it, the *profile mechanism is the way to affect behavior at
run-time*.  So I'm setting a system property in the profile that will
trigger a specific file to be loaded.

If there is a better way for my code to know what profile was selected, I've
not been able to find it.

Since each profile is identical except for the id and the value of the
system property being set and maven encourages universal reuse, I was hoping
to just reference the profile id when setting the system property.  Then
when I copy the profile to add new ones all I would need to change is the
profile id.

Thoughts?
On Thu, Jan 20, 2011 at 8:39 AM, Wayne Fay <wayne...@gmail.com> wrote:

> > I'm new to Maven and am building a POM with profiles.  I want to be able
> to
>
> Then you are most likely doing things "wrong." Is there no other way
> to build/test your app without using profiles?
>
> > Currently the value of the "config" system property is equivalent to the
> > value of the profile id.  Is there a syntax in the POM for referencing
> the
> > id of the profile that is in the parent chain of the property being set?
>
> Not that I'm aware of. The simplest fix is to just put the word
> "staging" in that plugin configuration, since your plugin is inside
> the profile anyway. The next simplest "fix" is to have another
> property, say profile-name, that you copy your profile id to and then
> reference that property where you need to use the name.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


-- 
Jeff Vincent
predato...@gmail.com
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent

Reply via email to