I thought I had a solution, but it didn't work. I think it should work, but I'm not certain. This could be a bug. This is what I had:

   <properties>
       <dev-active>true</dev-active>
   </properties>

   <profiles>
       <profile>
           <id>dev</id>
           <activation>
               <property>
                   <name>dev-active</name>
                   <value>true</value>
               </property>
           </activation>
       </profile>
       <profile>
           <id>prod</id>
           <activation>
               <property>
                   <name>env</name>
                   <value>prod</value>
               </property>
           </activation>
           <properties>
               <dev-active>false</dev-active>
           </properties>
       </profile>
       <profile>
           <id>qa</id>
           <activation>
               <property>
                   <name>env</name>
                   <value>qa</value>
               </property>
           </activation>
           <properties>
               <dev-active>false</dev-active>
           </properties>
       </profile>
   </profiles>

In short, only activate dev when the property is true. When activating another profile, set the property to false. Unfortunately, it ain't working. Somebody has a better idea?

Hth,

Nick Stolwijk

Morris Jones wrote:
Say I have a settings.xml file with three profiles, "dev" "qa" and "production". The active profile will set variables that determine which database to use and things like that.

I have activations so that I can use -Denv=qa or -Denv=dev to get the right profile. But I'd like to have one of the profiles to be the default _in case another one isn't selected_. That way I'm not always having to type -Denv=dev when I do a dev built.

So I put an <activeByDefault>true</activeByDefault> tag in the dev profile, and false on the others.

Now mvn help:active-profiles reports:

The following profiles are active:

 - env-dev (source: settings.xml)
 - env-dev (source: settings.xml)

(Twice?)

And if I do mvn -Denv=qa help:active-profiles I get:

The following profiles are active:

 - env-dev (source: settings.xml)
 - env-qa (source: settings.xml)
 - env-dev (source: settings.xml)

And my app is built with the dev profile.

In other words, I can't override the activeByDefault setting, no matter what I specify. I get the same thing if I say "mvn -P env-qa help:active-profiles".

What is it I'm missing here?

Mojo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to