Maven Resources Plugin
  1. Maven Resources Plugin
  2. MRESOURCES-99

${project.baseUri} and ${maven.build.timestamp} are not expanded by resource filtering

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3, 2.4
    • Fix Version/s: None
    • Component/s: interpolation
    • Labels:
      None
    • Number of attachments :
      0

      Description

      When filtering resources, $

      {project.baseUri}

      and $

      {maven.build.timestamp}

      are not expanded (remains unchanged in the output file).

        Issue Links

          Activity

          Paul Benedict made changes -
          Field Original Value New Value
          Link This issue relates to MNG-2562 [ MNG-2562 ]
          Hide
          John Casey added a comment -

          where does project.baseUri come from?

          Show
          John Casey added a comment - where does project.baseUri come from?
          Hide
          Thomas Champagne added a comment -

          $

          {project.baseUri}

          comes from the documentation
          and from this bug : MNG-3760.

          Show
          Thomas Champagne added a comment - $ {project.baseUri} comes from the documentation and from this bug : MNG-3760 .
          Hide
          Dimitri Alexeev added a comment -

          actually, the Version 2.2 is also affected

          Show
          Dimitri Alexeev added a comment - actually, the Version 2.2 is also affected
          Hide
          Evgeny Mandrikov added a comment -

          Workaroung: add following property

          pom.xml
          <properties>
            <timestamp>${maven.build.timestamp}</timestamp>
          </properties>
          

          and after that you can reference it within resource.

          Show
          Evgeny Mandrikov added a comment - Workaroung: add following property pom.xml <properties> <timestamp>${maven.build.timestamp}</timestamp> </properties> and after that you can reference it within resource.
          Hide
          Andreas Sewe added a comment -

          I couldn't get Evgeny's workaround to work on Maven 3.0-alpha-7 and 3.0-beta-1. According to help:effective-pom the property {{$

          {maven.build.timestamp}

          }} does get interpolated in the POM, but resource filtering (which affects the file in question, at least according to mvn -X) doesn't work.

          Show
          Andreas Sewe added a comment - I couldn't get Evgeny's workaround to work on Maven 3.0-alpha-7 and 3.0-beta-1. According to help:effective-pom the property {{$ {maven.build.timestamp} }} does get interpolated in the POM, but resource filtering (which affects the file in question, at least according to mvn -X ) doesn't work.
          Hide
          Andreas Sewe added a comment -

          Actually, me last comment isn't true; the workaround does work with Maven 3.

          What happened was this: I followed the advice of http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html and got burned by the fact that the manifest file include was the one from the unfiltered source directory rather than from the filtered target directory.

          Show
          Andreas Sewe added a comment - Actually, me last comment isn't true; the workaround does work with Maven 3. What happened was this: I followed the advice of http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html and got burned by the fact that the manifest file include was the one from the unfiltered source directory rather than from the filtered target directory.
          Dennis Lundberg made changes -
          Component/s interpolation [ 14619 ]
          Hide
          Petr Janata added a comment -

          The workaround mentioned by Evgeny seems to be dependent on environment.

          It works on my windows machine:
          Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100)
          Java version: 1.6.0_23, vendor: Sun Microsystems Inc.
          Java home: c:\progs\java\jdk1.6.0_23_32bit\jre
          Default locale: cs_CZ, platform encoding: Cp1250
          OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

          effective pom:
          <timestamp>20110325-1614</timestamp>

          But does not work on Jenkins CI server with Debian:
          Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100)
          Java version: 1.6.0_22, vendor: Sun Microsystems Inc.
          Java home: /usr/lib/jvm/java-6-sun-1.6.0.22/jre
          Default locale: en_US, platform encoding: UTF-8
          OS name: "linux", version: "2.6.18.8-xenu", arch: "amd64", family: "unix"

          effective pom:
          <timestamp>$

          {maven.build.timestamp}

          </timestamp>

          Show
          Petr Janata added a comment - The workaround mentioned by Evgeny seems to be dependent on environment. It works on my windows machine: Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100) Java version: 1.6.0_23, vendor: Sun Microsystems Inc. Java home: c:\progs\java\jdk1.6.0_23_32bit\jre Default locale: cs_CZ, platform encoding: Cp1250 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows" effective pom: <timestamp>20110325-1614</timestamp> But does not work on Jenkins CI server with Debian: Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100) Java version: 1.6.0_22, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-sun-1.6.0.22/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.18.8-xenu", arch: "amd64", family: "unix" effective pom: <timestamp>$ {maven.build.timestamp} </timestamp>
          Hide
          Olivier Lamy added a comment -
          Show
          Olivier Lamy added a comment - @Petr see http://issues.jenkins-ci.org/browse/JENKINS-8573
          Hide
          The Alchemist added a comment - - edited

          I would close this issue, as it has been fixed, as Olivier Lamy has shown. I have confirmed that <timestamp>${maven.build.timestamp}</timestamp> works.

          Show
          The Alchemist added a comment - - edited I would close this issue, as it has been fixed, as Olivier Lamy has shown. I have confirmed that <timestamp>${maven.build.timestamp}</timestamp> works.
          Hide
          Evgeny Mandrikov added a comment -

          I'm not sure that issue should be closed, because definition of a new property - it's just a workaround for original problem.

          Show
          Evgeny Mandrikov added a comment - I'm not sure that issue should be closed, because definition of a new property - it's just a workaround for original problem.
          Benjamin Bentmann made changes -
          Link This issue is duplicated by MRESOURCES-150 [ MRESOURCES-150 ]
          Hide
          Aaron Digulla added a comment -

          I agree; it worries me that some properties are visible in the POM but not in the resource plugin. What is causing this? Are there two types of properties?

          Show
          Aaron Digulla added a comment - I agree; it worries me that some properties are visible in the POM but not in the resource plugin. What is causing this? Are there two types of properties?
          Hide
          The Alchemist added a comment -

          @Aaron/@Evgeny: Yeah, I revise what I said. You guys are right: this should stay open.

          Show
          The Alchemist added a comment - @Aaron/@Evgeny: Yeah, I revise what I said. You guys are right: this should stay open.
          Hide
          Matthias Müller added a comment -

          Just ran into this issue today. It's a pity it isn't solved after more than three years
          Is backwards-compatibility to Maven 2.x important at this point?
          When upgrading to Maven 3.x, man could somehow use a

          src.main.java.org.apache.maven.model.interpolation.BuildTimestampValueSource

          https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob;f=maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java

          I think someone who's familiar with building maven plugins (which excludes me ) could do this in very little time...

          Show
          Matthias Müller added a comment - Just ran into this issue today. It's a pity it isn't solved after more than three years Is backwards-compatibility to Maven 2.x important at this point? When upgrading to Maven 3.x, man could somehow use a src.main.java.org.apache.maven.model.interpolation.BuildTimestampValueSource https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob;f=maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java I think someone who's familiar with building maven plugins (which excludes me ) could do this in very little time...
          Karl-Heinz Marbaise made changes -
          Link This issue is related to MASSEMBLY-603 [ MASSEMBLY-603 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Thomas Champagne
            • Votes:
              39 Vote for this issue
              Watchers:
              33 Start watching this issue

              Dates

              • Created:
                Updated: