Maven 2.x Resources Plugin

${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

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.
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
Karl Pietrzak 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
Karl Pietrzak 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.

People

Vote (23)
Watch (21)

Dates

  • Created:
    Updated: