Details
Description
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.
Attachments
Attachments
Issue Links
- depends upon
-
MNG-3988 [regression] Profiles.xml is not processed
- Closed