Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-1775

No property expansion in profile activation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0, 2.0.1
    • None
    • None
    • Linux

    Description

      I have a profile specified in the pom.xml of a project. It is inteded to be activated based on the presence or absence of a file, using the <file> profile activator.

      The profiles are simple:
      <profile>
      <id>metis</id>
      <activation>
      <file><missing>${basedir}/../build.properties</missing></file>
      </activation>
      <build>
      <filters><filter>${basedir}/../build.properties.metis</filter></filters>
      </build>
      </profile>
      <profile>
      <id>dev</id>
      <activation>
      <file><exists>${basedir}/../build.properties</exists></file>
      </activation>
      <build>
      <filters><filter>${basedir}/../build.properties</filter></filters>
      </build>
      </profile>

      The problem comes in with ${basedir} – it isn't being expanded for purposes of evaluating the file. It's trying to look for a file named "${basedir}/../build.properties", rather than "/home/joe/projectX/projY/../build.properties"; as a result, the "missing" directive is always true, and the dev profile is never activated. When the filter path is evaluated, the ${basedir} property is evaluated, however.

      Attachments

        1. basedir_in_activation.patch
          19 kB
          Karel Vervaeke
        2. MNG-1775-maven2.2.x.patch
          19 kB
          Karel Vervaeke
        3. test.zip
          3 kB
          Karel Vervaeke
        4. test2.zip
          5 kB
          Karel Vervaeke

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              eandres Eric Andresen
              Votes:
              10 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: