To answer my own question (talking to myself in public... sheesh), I fixed it 
well enough for me (see pom below).  I also think it turns out as working as 
designed.  Apparently if any activation element comes up true, it overrides all 
activeByDefault elements [1].  I guess I assumed that meant it was active 
unless deactivated via cli.  Live and learn.

-Jim

[1] http://maven.apache.org/guides/introduction/introduction-to-profiles.html 
(search for activeByDefault)


<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>0.1</version>
    <profiles>
        <profile>
            <id>win32</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>env.BUILD_TAG</name>
                </property>
            </activation>
        </profile>
        <profile>
            <id>win64</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>env.BUILD_TAG</name>
                </property>
            </activation>
        </profile>
        <profile>
            <id>hudson</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>env.BUILD_TAG</name>
                </property>
            </activation>
        </profile>
    </profiles>
</project>

-----Original Message-----
From: Jim McCaskey [mailto:jim.mccas...@pervasive.com] 
Sent: Thursday, February 25, 2010 2:41 PM
To: 'users@maven.apache.org'
Subject: Multiple active profiles issue

Hello all,

I'm having a little problem with profiles that I can't quite seem to figure 
out.  I have a pom that has 3 profiles defined in it.  2 active by default and 
one active if a env var is set (BUILD_TAG).  My little test pom is below.

Now, when I do not set BUILD_TAG, it works as I expect.  

[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'test:test:pom:0.1':

The following profiles are active:

 - win32 (source: pom)
 - win64 (source: pom)
 - profile-1 (source: settings.xml)

But as soon as I set the env var, the win32 and win64 profiles go away:

[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'test:test:pom:0.1':

The following profiles are active:

 - hudson (source: pom)
 - profile-1 (source: settings.xml)

We typically use Maven 2.1.0 but I have also tested Maven 2.2.1.  I tried Maven 
3.0 and that ignores the env var all together.  Any ideas on what I may be 
doing wrong in my pom?

-Jim


<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>0.1</version>
    <profiles>
        <profile>
            <id>win32</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>win64</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>hudson</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>env.BUILD_TAG</name>
                </property>
            </activation>
        </profile>
    </profiles>
</project>


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




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

Reply via email to