Hi,

<activation><property><name>platform</name><value>!all</value></property></activation>

means that the profile will be active when the system property "platform" is not defined, or is defined with a value different than "all". Put another way, it is always active unless "platform" is equal to "all". This explains your observations, where both platform-reactor and default-reactor are active when the system property isn't set.

There was the JIRA MNGSITE-293, in which the documentation was clarified to reflect this.

Guillaume

Le 12/03/2017 à 05:00, Justin Georgeson a écrit :
Seeing that I can ! the property value in a profile activation, I assumed there 
were three states to consider when evaluating the property activation:

     1. Property not set
     2. Property set and value does not match
     3. Property set and value does match

With this assumption I thought that with profiles such as these

     <profiles>
         <profile>
             <id>default-reactor</id>
             
<activation><property><name>!platform</name></property></activation>
         </profile>
         <profile>
             <id>platform-reactor</id>
             
<activation><property><name>platform</name><value>!all</value></property></activation>
         </profile>
         <profile>
             <id>all-platforms-reactor</id>
             
<activation><property><name>platform</name><value>all</value></property></activation>
         </profile>
     </profiles>

I would only see one of the three profiles active at a time. However when I run 
Maven 'mvn help:active-profiles' with no 'platform' property then both the 
'default-reactor' and 'platform-reactor' are active. When I set the 'platform' 
property then I see the behavior I expected. Looking at the source

https://github.com/apache/maven/blob/38300cf2832e9a40198091aa9e0bf6d3dbc3268d/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java#L95

It's doing a string compare of the activation's declared property value against the 
context's property value, but it's not checking the context has a property set. But I 
would infer from the comment on L94 ("we have a value, so it has to match the system 
value...") that an unset property should not match a !value activation.

Should I open a JIRA issue as a bug, or as a feature request?

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.

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



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus


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

Reply via email to