Maven
  1. Maven
  2. MNG-1995

filtering element in pom.xml ignore properties

    Details

      Description

      <jvanzyl> you can mention it0091 as the test case
      The following pom.xml does not end up filtering the resources:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

      <modelVersion>4.0.0</modelVersion>
      <groupId>org.objectweb.celtix</groupId>
      <artifactId>test</artifactId>
      <packaging>jar</packaging>
      <version>1.0</version>
      <name>Test</name>

      <properties>
      <filter.resources>true</filter.resources>
      </properties>

      <build>
      <resources>
      <resource>
      <directory>src/main/resources</directory>
      <includes>
      <include>**</include>
      </includes>
      <filtering>$

      {filter.resources}

      </filtering>
      </resource>
      </resources>
      </build>
      </project>

        Issue Links

          Activity

          Daniel Kulp created issue -
          Brett Porter made changes -
          Field Original Value New Value
          Complexity Intermediate
          Project Maven 2.x Resources Plugin [ 11145 ] Maven 2 [ 10500 ]
          Key MRESOURCES-9 MNG-1995
          Vincent Massol made changes -
          Workflow Maven [ 46008 ] Maven New [ 47367 ]
          John Casey made changes -
          Fix Version/s 2.0.5 [ 12294 ]
          Description
          <jvanzyl> you can mention it0091 as the test case
          The following pom.xml does not end up filtering the resources:

          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
           
               <modelVersion>4.0.0</modelVersion>
              <groupId>org.objectweb.celtix</groupId>
              <artifactId>test</artifactId>
              <packaging>jar</packaging>
              <version>1.0</version>
              <name>Test</name>
           
              <properties>
                  <filter.resources>true</filter.resources>
              </properties>
           
              <build>
                  <resources>
                      <resource>
                          <directory>src/main/resources</directory>
                          <includes>
                              <include>**</include>
                          </includes>
                          <filtering>${filter.resources}</filtering>
                      </resource>
                  </resources>
              </build>
          </project>



          <jvanzyl> you can mention it0091 as the test case
          The following pom.xml does not end up filtering the resources:

          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
           
               <modelVersion>4.0.0</modelVersion>
              <groupId>org.objectweb.celtix</groupId>
              <artifactId>test</artifactId>
              <packaging>jar</packaging>
              <version>1.0</version>
              <name>Test</name>
           
              <properties>
                  <filter.resources>true</filter.resources>
              </properties>
           
              <build>
                  <resources>
                      <resource>
                          <directory>src/main/resources</directory>
                          <includes>
                              <include>**</include>
                          </includes>
                          <filtering>${filter.resources}</filtering>
                      </resource>
                  </resources>
              </build>
          </project>



          Brett Porter made changes -
          Link This issue is duplicated by MNG-2223 [ MNG-2223 ]
          Hide
          John Casey added a comment -

          This will have to wait for Maven 2.1.

          The reason is that the filtering property in org.apache.maven.model.Resource is actually a boolean, not a String. This is correct from a pure perspective, but it compromises our ability to interpolate that value in the current project-loading process. The reason is that a given POM is first read into a org.apache.maven.model.Model intsance, /then/ interpolated, which means that the expression above:

          <resource><filtering>$

          {filter.resources}

          </filtering></resource>

          has already been parsed (by the XML-parsing part of the project-loading process) into the boolean value /false/.

          In order to change this, we'd need to do one of two things:

          1. Change the Resource.filtering property to a String, so that expressions would be preserved long enough to be interpolated by the current POM loading process.

          2. Change the POM loading process to read/interpolate all in one step, before a Model instance is created.

          #1 is not feasible for 2.0.x, since it would change a public API that many plugins depend on. #2 is more reasonable, but cannot happen in the 2.0.x line, due to the relative complexity involved with changing something so core to Maven itself.

          In fact, we already have some plans to change the POM loading process to make it more flexible, and hopefully resolve more of these sticky interpolation problems on the way.

          Show
          John Casey added a comment - This will have to wait for Maven 2.1. The reason is that the filtering property in org.apache.maven.model.Resource is actually a boolean, not a String. This is correct from a pure perspective, but it compromises our ability to interpolate that value in the current project-loading process. The reason is that a given POM is first read into a org.apache.maven.model.Model intsance, /then/ interpolated, which means that the expression above: <resource><filtering>$ {filter.resources} </filtering></resource> has already been parsed (by the XML-parsing part of the project-loading process) into the boolean value /false/. In order to change this, we'd need to do one of two things: 1. Change the Resource.filtering property to a String, so that expressions would be preserved long enough to be interpolated by the current POM loading process. 2. Change the POM loading process to read/interpolate all in one step, before a Model instance is created. #1 is not feasible for 2.0.x, since it would change a public API that many plugins depend on. #2 is more reasonable, but cannot happen in the 2.0.x line, due to the relative complexity involved with changing something so core to Maven itself. In fact, we already have some plans to change the POM loading process to make it more flexible, and hopefully resolve more of these sticky interpolation problems on the way.
          John Casey made changes -
          Fix Version/s 2.1 [ 11704 ]
          Fix Version/s 2.0.5 [ 12294 ]
          Jason van Zyl made changes -
          Fix Version/s 2.1.x [ 13142 ]
          Fix Version/s 2.1 [ 11704 ]
          Brett Porter made changes -
          Component/s Inheritance and Interpolation [ 11570 ]
          John Casey made changes -
          Link This issue relates to MNG-3530 [ MNG-3530 ]
          Hide
          Benjamin Bentmann added a comment -

          The corresponding it0091 is passing for me on trunk, so this seems to be resolved and could be closed by the responsible committer

          Show
          Benjamin Bentmann added a comment - The corresponding it0091 is passing for me on trunk, so this seems to be resolved and could be closed by the responsible committer
          Hide
          shane.isbell added a comment -

          Fixed.

          Show
          shane.isbell added a comment - Fixed.
          Benjamin Bentmann made changes -
          Link This issue is duplicated by MNG-3443 [ MNG-3443 ]
          Jason van Zyl made changes -
          Fix Version/s 3.0 [ 13142 ]
          Fix Version/s 3.x [ 13145 ]
          Brett Porter made changes -
          Resolution Fixed [ 1 ]
          Fix Version/s 3.x [ 13145 ]
          Assignee Shane Isbell [ sisbell ]
          Fix Version/s 3.0-alpha-1 [ 13143 ]
          Status Open [ 1 ] Closed [ 6 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Workflow jira [ 12712664 ] Default workflow, editable Closed status [ 12752551 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Workflow jira [ 12949765 ] Default workflow, editable Closed status [ 12985965 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          1069d 17h 29m 1 Brett Porter 18/Dec/08 06:40

            People

            • Assignee:
              Shane Isbell
              Reporter:
              Daniel Kulp
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development