Profiles.xml does not pickup OS family
--------------------------------------

                 Key: MNG-3933
                 URL: http://jira.codehaus.org/browse/MNG-3933
             Project: Maven 2
          Issue Type: Bug
          Components: Profiles
    Affects Versions: 2.0.9
         Environment: Ubuntu 8.0.4 64-bit [2.6.24-21-generic #1 SMP Tue Oct 21 
23:09:30 UTC 2008 x86_64 GNU/Linux] and 
Windows XP sp2 32-bit
            Reporter: sanjiv sahayam


When using profiles.xml and specifying an OS family activator such as :

                <os>
                    <family>unix</family>
                </os>


The OS family is not detected and hence the profile never activates. I have 
verified this through mvn help:active-profiles. I have tried this on Windows(XP 
sp2) as well as Linux (Ubuntu 8.0.4). The only way I can get  the profiles to 
activate is  via systems properties:

            <activation>
                <property>
                    <name>unix-profile</name>
                </property>
            </activation>

and then use something of the form: mvn clean test -Dunix-profile.

I've created an example that depends on a specific version of Junit depending 
on the OS. Unix depends on 4.5 and Windows on 3.8.

Here's my profiles.xml:

<profilesXml
        xmlns="http://maven.apache.org/PROFILES/1.0.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 
http://maven.apache.org/xsd/profiles-1.0.0.xsd";>
    <profiles>
        <profile>
            <id>unix</id>
            <activation>
                <os>
                    <family>unix</family>
                </os>
            </activation>
            <properties>
                    <junit.version>4.5</junit.version>
            </properties>
        </profile>
        <profile>
            <id>windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                    <junit.version>3.8</junit.version>
            </properties>
        </profile>
    </profiles>
</profilesXml>

Here's my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>au.maven.test</groupId>
    <artifactId>profiles-bug</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


The only way I can get the correct artefact  to be used is via a system 
property. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to