Maven 2 & 3

POM interpolation problem in maven-2.0.3

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.0.3
  • Fix Version/s: 2.0.4
  • Labels:
    None
  • Environment:
    xp
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

my maven-2.0.3 shows ${project.build.directory}=target. Instead of the fullpath
this surely breaks the reactor build/test.

here is an example pom

<?xml version="1.0"?>
<project>

<modelVersion>4.0.0</modelVersion>

<!--
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
-->
<packaging>jar</packaging>
<groupId>test</groupId>
<artifactId>child</artifactId>
<version>1.0-SNAPSHOT</version>

<name>child</name>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>echo</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>project.build.directory:${project.build.directory}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

</build>

</project>

Carlos also comfirmed

Confirmed

2.0.3 = project.build.directory:target
2.0.2 = project.build.directory:C:\Documents and
Settings\csanchez\Local Settings\Temp\target

Issue Links

Activity

Hide
Emmanuel Venisse added a comment -

${project.build.directory} works fine, it's only the echo result that's strange.

Add this after the echo :

<mkdir dir="${project.build.directory}"/>
<touch file="${project.build.directory}/${project.artifactId}.txt"/>

and create a child project of your pom with the same plugin execution, and your see that it create two txt files in correct directories (parent/target and child/target)

D:\tmp\testmaven>mvn generate-sources
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] parent
[INFO] child
[INFO] ----------------------------------------------------------------------------
[INFO] Building parent
[INFO] task-segment: [generate-sources]
[INFO] ----------------------------------------------------------------------------
[INFO] [antrun:run {execution: echo}]
[INFO] Executing tasks
[echo] project.build.directory:target
[mkdir] Created dir: D:\tmp\testmaven\target
[touch] Creating D:\tmp\testmaven\target\parent.txt
[INFO] Executed tasks
[INFO] ----------------------------------------------------------------------------
[INFO] Building child
[INFO] task-segment: [generate-sources]
[INFO] ----------------------------------------------------------------------------
[INFO] [antrun:run {execution: echo}]
[INFO] Executing tasks
[echo] project.build.directory:target
[mkdir] Created dir: D:\tmp\testmaven\child\target
[touch] Creating D:\tmp\testmaven\child\target\child.txt
[INFO] Executed tasks
[INFO] [antrun:run {execution: echo}]
[INFO] Executing tasks
[echo] project.build.directory:target
[INFO] Executed tasks
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] parent ................................................ SUCCESS [1.375s]
[INFO] child ................................................. SUCCESS [0.047s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Mar 29 11:23:54 CEST 2006
[INFO] Final Memory: 2M/4M
[INFO] ------------------------------------------------------------------------

So I think the issue can be closed

Show
Emmanuel Venisse added a comment - ${project.build.directory} works fine, it's only the echo result that's strange. Add this after the echo : <mkdir dir="${project.build.directory}"/> <touch file="${project.build.directory}/${project.artifactId}.txt"/> and create a child project of your pom with the same plugin execution, and your see that it create two txt files in correct directories (parent/target and child/target) D:\tmp\testmaven>mvn generate-sources [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] parent [INFO] child [INFO] ---------------------------------------------------------------------------- [INFO] Building parent [INFO] task-segment: [generate-sources] [INFO] ---------------------------------------------------------------------------- [INFO] [antrun:run {execution: echo}] [INFO] Executing tasks [echo] project.build.directory:target [mkdir] Created dir: D:\tmp\testmaven\target [touch] Creating D:\tmp\testmaven\target\parent.txt [INFO] Executed tasks [INFO] ---------------------------------------------------------------------------- [INFO] Building child [INFO] task-segment: [generate-sources] [INFO] ---------------------------------------------------------------------------- [INFO] [antrun:run {execution: echo}] [INFO] Executing tasks [echo] project.build.directory:target [mkdir] Created dir: D:\tmp\testmaven\child\target [touch] Creating D:\tmp\testmaven\child\target\child.txt [INFO] Executed tasks [INFO] [antrun:run {execution: echo}] [INFO] Executing tasks [echo] project.build.directory:target [INFO] Executed tasks [INFO] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] ------------------------------------------------------------------------ [INFO] parent ................................................ SUCCESS [1.375s] [INFO] child ................................................. SUCCESS [0.047s] [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Wed Mar 29 11:23:54 CEST 2006 [INFO] Final Memory: 2M/4M [INFO] ------------------------------------------------------------------------ So I think the issue can be closed
Hide
Dan Tran added a comment -

more notes

you are right about mkdir, how ever

my surefire configuration the usage of ${project.build.directory}, so this issue is valid

I am sure this issue will hit other usages

-D


On 3/29/06, Emmanuel Venisse <emmanuel@venisse.net> wrote:
${project.build.directory} works fine, it's only the echo result that's strange.

Add this after the echo :

<mkdir dir="${project.build.directory}"/>
<touch file="${project.build.directory}/${project.artifactId}.txt"/>

and create a child project of your pom with the same plugin execution, and your see that it create
two txt files in correct directories (parent/target and child/target)

Show
Dan Tran added a comment - more notes you are right about mkdir, how ever my surefire configuration the usage of ${project.build.directory}, so this issue is valid I am sure this issue will hit other usages -D On 3/29/06, Emmanuel Venisse <emmanuel@venisse.net> wrote: ${project.build.directory} works fine, it's only the echo result that's strange. Add this after the echo : <mkdir dir="${project.build.directory}"/> <touch file="${project.build.directory}/${project.artifactId}.txt"/> and create a child project of your pom with the same plugin execution, and your see that it create two txt files in correct directories (parent/target and child/target)
Hide
Dan Tran added a comment -

Map injection also encounters this problem in 2.0.3.
native-maven-plugin requires this features to setup path environment when forking a test

Show
Dan Tran added a comment - Map injection also encounters this problem in 2.0.3. native-maven-plugin requires this features to setup path environment when forking a test
Hide
John Casey added a comment -

just adding links, to make this easier to see.

Show
John Casey added a comment - just adding links, to make this easier to see.
Hide
John Casey added a comment -

just linking to make it easier to see.

Show
John Casey added a comment - just linking to make it easier to see.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: