Maven
  1. Maven
  2. MNG-4565

Requiring multiple profile activation conditions to be true does not work

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1, 3.2.1
    • Fix Version/s: 3.2.2
    • Component/s: Profiles
    • Labels:
      None
    • Environment:
      All platforms.
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      According to the documentation at http://www.sonatype.com/books/mvnref-book/reference/profiles-sect-activation.html a profile is activated when all activation conditions are met (which makes sense of course). But when I try to use this it does not work. It seems maven does an OR instead of an AND (which is not rearly as useful and is the opposite of what the documentation says at the previous link).

      For example, if I have one profile that is activated like this:

               <activation>
                  <activeByDefault>false</activeByDefault>
                  <os>
                     <name>linux</name>
                  </os>
               </activation>

      and another profile that is activated like this:

              <activation>
                  <activeByDefault>false</activeByDefault>
                  <os>
                     <name>linux</name>
                  </os>
                  <property>
                      <name>release</name>
                      <value>true</value>
                  </property>
               </activation>

      Then I would expect the second profile to only be activated if the OS is linux and the release property is defined.

      When I run 'mvn help:active-profiles' however, maven shows that both profiles are active even though the release property is not defined.

        Issue Links

          Activity

          Hide
          Ondrej Zizka added a comment -

          Seems that Karel's extension solves MNG-5194.

          Show
          Ondrej Zizka added a comment - Seems that Karel's extension solves MNG-5194 .
          Hide
          Ronny Pscheidl added a comment -

          This extension should solve the problem when all activation conditions are met:

          https://github.com/johnjcool/and-activation-profile-selector

          Show
          Ronny Pscheidl added a comment - This extension should solve the problem when all activation conditions are met: https://github.com/johnjcool/and-activation-profile-selector
          Hide
          SebbASF added a comment -

          The Sonatype book still says that activation conditions are ANDed

          http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html#profiles-sect-activation-config

          "A profile is activated when all activation criteria has been satisfied." (sic)

          Still broken in Maven 3.0.5

          Show
          SebbASF added a comment - The Sonatype book still says that activation conditions are ANDed http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html#profiles-sect-activation-config "A profile is activated when all activation criteria has been satisfied." (sic) Still broken in Maven 3.0.5
          Hide
          Konstantin Perikov added a comment -

          I've create pull request for this functionality - https://github.com/apache/maven/pull/16

          Show
          Konstantin Perikov added a comment - I've create pull request for this functionality - https://github.com/apache/maven/pull/16
          Hide
          Jason van Zyl added a comment -

          Fixed on c6529932f9e3efdfc86ed73f59a307a8f8b6ea5f

          Show
          Jason van Zyl added a comment - Fixed on c6529932f9e3efdfc86ed73f59a307a8f8b6ea5f

            People

            • Assignee:
              Jason van Zyl
              Reporter:
              Nicholas Allen
            • Votes:
              57 Vote for this issue
              Watchers:
              46 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: