History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MNG-3328
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Paul Gier
Votes: 3
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 2

Allow multiple profile activation properties.

Created: 19/Dec/07 11:45 AM   Updated: 07/Jul/08 07:48 AM
Component/s: Profiles
Affects Version/s: 2.0.8
Fix Version/s: 3.0

Time Tracking:
Not Specified

Issue Links:
Related
 


 Description  « Hide
The pom model should be changed to allow multiple properties to activate a profile. So the profile activation section could look something like this:

<activation>
<properties>
<my-prop-1>some-value</my-prop-1>
<my-prop-2>another-value</my-prop-2>
</properties>
</activation>

This would provide more flexibility in profile activation.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Elifarley Callado Coelho - 27/Mar/08 02:04 PM
Maybe adding support for boolean operators would be nice. Here is an example:


<activation>

<and>
<property><name>prop-1</name></property>

<property><name>prop-2</name></property>

<property><name>prop-3</name></property>

<or>
<property><name>prop-4</name></property>

<not>
<property><name>prop-5</name></property>
</not>

<property><name>prop-6</name></property>

<os>MacOS</os>

</or>

</and>

</activation>


Paul Gier - 16/May/08 10:47 AM
For better compatibility with the current maven model, the syntax for this should look more like this:
<activation>
  <property>
    <name>my-prop-1</name>
    <value>some-value</value>
  </property>
  <property>
    <name>my-prop-2</name>
    <value>another-value</value>
  </property>
</activation>

If either of these properties match the given value, the profile should be activated.
In addition, the other activators (os, jvm, file, etc) should also be allowed to have multiple values.


Marco Sandrini - 07/Jul/08 07:43 AM - edited
boolean operators could be achieved with the following syntax (let's assume with want to express the condition ((a && b) || (c && d)) )
<activations>
  <activation>
    <properties>
      <property>
        <name>my-prop-A</name>
        <value>valueA</value>
      </property>
      <property>
        <name>my-prop-B</name>
        <value>valueB</value>
      </property>
    </properties>
  </activation>
  <activation>
    <properties>
      <property>
        <name>my-prop-C</name>
        <value>valueC</value>
      </property>
      <property>
        <name>my-prop-D</name>
        <value>valueD</value>
      </property>
   </properties>
  </activation>
</activations>

so all the conditions within one activation are considered as an AND and the different activation elements are considered as an OR. The downside of this proposal is of course that it would break the current POM model.