<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.1.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>
<groupId>de.ralfn.tmp</groupId>
<artifactId>maven4-profile-activation-by-condition-tester</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<root>true</root>
</properties>
<profiles>
<!-- working -->
<profile>
<id>profile-1</id>
<activation>
<condition>exists( '.profile-1' )</condition>
</activation>
</profile>
<profile>
<id>profile-1b</id>
<activation>
<condition>
exists( '.profile-1' )
</condition>
</activation>
</profile>
<!-- working, but kind of ugly -->
<profile>
<id>profile-2</id>
<activation>
<condition>exists( '.profile-2' ) && missing( '.profile-1' )</condition>
<!--
Why not using something like this? (may be just as an optional version instead of the '&&' operator)
<condition>exists( '.profile-2' ) AND missing( '.profile-1' )</condition>
This could be nice, too., but maybe is somewhat harder to implement. We have a not(..) function anyway.
<condition> and( exists( '.profile-2' ), missing( '.profile-1' ) ) </condition>
-->
</activation>
</profile>
<!-- working, but still ugly -->
<profile>
<id>profile-2b</id>
<activation>
<condition><![CDATA[exists( '.profile-2' ) && missing( '.profile-1' )]]></condition>
</activation>
</profile>
<!-- working workaround to get it a bit cleaner -->
<profile>
<id>profile-2c</id>
<activation>
<condition><![CDATA[
exists( '.profile-2' ) && missing( '.profile-1' ) && missing( '.profile-0' )
]]></condition>
</activation>
</profile>
<!-- not working, just because of the line break -->
<profile>
<id>bad-profile-2d</id>
<activation>
<condition><![CDATA[
exists( '.profile-2' )
&& missing( '.profile-1' ) && missing( '.profile-0' )
]]></condition>
</activation>
</profile>
</profiles>
</project>
Affected version
rc5
Bug description
I found some issues in the
<condition>syntax.Maybe there is room for improvements.
Please have a look at the comments in the example pom.xml