Uploaded image for project: 'Maven Resources Plugin'
  1. Maven Resources Plugin
  2. MRESOURCES-118

${project.dependencies[0].artifactId} is not expanded by resource filtering

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.3, 2.4, 2.4.1
    • Fix Version/s: None
    • Component/s: interpolation
    • Labels:
      None
    • Environment:
      Maven 2.2.1, Ubuntu 9.10, Java 6u16

      Description

      When filtering resources, ${project.dependencies[0].artifactId} is not expanded (remains unchanged in the output file).

      I've tried to define a property in my pom to workaround this issue:

      <properties>
      <myartifact>${project.dependencies[0].artifactId}</myartifact>
      </properties>

      But, still, filtering the following file:

      <somenode>
        <fileName>${project.dependencies[0].artifactId}</fileName>
        <fileName>${myartifact}</fileName>
      </somenode>
      

      Produces the following unexpected result:

      <somenode>
        <fileName>${project.dependencies[0].artifactId}</fileName>
        <fileName>${project.dependencies[0].artifactId}</fileName>
      </somenode>
      

      The only working workaround I've found is to use the antrun plugin:

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <configuration>
              <tasks>
                <echo>${project.dependencies[0].artifactId}</echo>
                <echo>${artifactId}</echo>
                <replace file="${project.build.outputDirectory}/my.xml" token="@@@" value="${project.dependencies[0].artifactId}"/> 
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      

      I didn't test all cases but this problem may affect all "indexed" properties (as defined in PLXUTILS-37).

      I'm attaching a sample project demonstrating this problem.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pthivent Pascal Thivent
              • Votes:
                6 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: