You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Reinhard Nägele <re...@mgm-tp.com> on 2009/04/20 08:31:16 UTC

[Fwd: Weird property replacement issue in Maven 2.1.0]

Hello,

Unfortunately, I got no response on the user list, so I'm forwarding 
this to the dev list now. I think this is a critical regression and 
opened a JIRA ticket for it.

http://jira.codehaus.org/browse/MNG-4140

Reinhard

-------- Original-Nachricht --------
Betreff: 	Weird property replacement issue in Maven 2.1.0
Datum: 	Wed, 15 Apr 2009 13:39:12 +0200
Von: 	Reinhard Nägele <re...@mgm-tp.com>
Antwort an: 	Maven Users List <us...@maven.apache.org>
An: 	Maven Users List <us...@maven.apache.org>


Hello,

I guess I spotted a bug in Maven 2.1.0. In a pom, which is intended to 
be used as a parent pom, we have the following profile. The profile is 
used to copy artifacts to Luntbuild's publish directory.

<profile>
 <id>luntbuild</id>
 <build>
   <plugins>
     <plugin>
       <artifactId>maven-dependency-plugin</artifactId>
       <executions>
         <execution>
           <id>copy</id>
           <phase>deploy</phase>
           <goals>
             <goal>copy</goal>
           </goals>
           <configuration>
             <artifactItems>
               <artifactItem>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>${project.artifactId}</artifactId>
                 <version>${project.version}</version>
                 <type>${project.packaging}</type>
               </artifactItem>
             </artifactItems>
             <outputDirectory>${artifactsDir}</outputDirectory>
           </configuration>
         </execution>
       </executions>
     </plugin>
   </plugins>
 </build>
</profile>

When I deploy the pom, ${project.version} is replaced with the pom's 
version (1 in this case) and ends up in Nexus as follows:

<artifactItem>
 <groupId>${project.groupId}</groupId>
 <artifactId>${project.artifactId}</artifactId>
 <version>1</version>
 <type>${project.packaging}</type>
</artifactItem>

This only happens with Maven 2.1.0. Maven 2.0.10 does not replace 
${project.version}. This is really weird because ${project.version} is 
used in other places throughout the pom (e. g. jar plugin config), where 
it is not replaced. Is there some special treatment to the version tag?

Should I open a JIRA for this?

Reinhard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [Fwd: Weird property replacement issue in Maven 2.1.0]

Posted by Benjamin Bentmann <be...@udo.edu>.
Reinhard Nägele wrote:

> Why is such version transformation done at all? What's the reasoning behind it?

http://jira.codehaus.org/browse/MNG-3057

> Usually, you would expect that your pom remains unchanged.

I believe we should probably at least leave those POMs untouched that 
don't originate from the current build. Technically, this version 
transformations checks

   if ( artifact instanceof ArtifactWithProject )

and otherwise outputs a warning (on debug level) but interpolates the 
file nevertheless. In real-life, this affects install:install-file and 
deploy:deploy-file. If users provide a hand-written POM or a POM from 
another repo, the POM is altered. Also, the process leaves 
target/pom-transformed.xml files around.


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: [Fwd: Weird property replacement issue in Maven 2.1.0]

Posted by Reinhard Nägele <Re...@mgm-tp.com>.
Why is such version transformation done at all? What's the reasoning behind it? Is this documented somewhere? Usually, you would expect that your pom remains unchanged.

Reinhard 


-----Original Message-----
From: John Casey [mailto:jdcasey@commonjava.org] 
Sent: Monday, April 20, 2009 5:30 PM
To: Maven Developers List
Subject: Re: [Fwd: Weird property replacement issue in Maven 2.1.0]

Thanks for filing this. It seems like the issue is related to a new interpolation step that takes place to transform version expression references in things like dependencies just before a POM is deployed. It looks like the profile information got caught in the crossfire.

Reinhard Nägele wrote:
> Hello,
> 
> Unfortunately, I got no response on the user list, so I'm forwarding 
> this to the dev list now. I think this is a critical regression and 
> opened a JIRA ticket for it.
> 
> http://jira.codehaus.org/browse/MNG-4140
> 
> Reinhard
> 
> -------- Original-Nachricht --------
> Betreff:     Weird property replacement issue in Maven 2.1.0
> Datum:     Wed, 15 Apr 2009 13:39:12 +0200
> Von:     Reinhard Nägele <re...@mgm-tp.com>
> Antwort an:     Maven Users List <us...@maven.apache.org>
> An:     Maven Users List <us...@maven.apache.org>
> 
> 
> Hello,
> 
> I guess I spotted a bug in Maven 2.1.0. In a pom, which is intended to 
> be used as a parent pom, we have the following profile. The profile is 
> used to copy artifacts to Luntbuild's publish directory.
> 
> <profile>
> <id>luntbuild</id>
> <build>
>   <plugins>
>     <plugin>
>       <artifactId>maven-dependency-plugin</artifactId>
>       <executions>
>         <execution>
>           <id>copy</id>
>           <phase>deploy</phase>
>           <goals>
>             <goal>copy</goal>
>           </goals>
>           <configuration>
>             <artifactItems>
>               <artifactItem>
>                 <groupId>${project.groupId}</groupId>
>                 <artifactId>${project.artifactId}</artifactId>
>                 <version>${project.version}</version>
>                 <type>${project.packaging}</type>
>               </artifactItem>
>             </artifactItems>
>             <outputDirectory>${artifactsDir}</outputDirectory>
>           </configuration>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>
> </profile>
> 
> When I deploy the pom, ${project.version} is replaced with the pom's 
> version (1 in this case) and ends up in Nexus as follows:
> 
> <artifactItem>
> <groupId>${project.groupId}</groupId>
> <artifactId>${project.artifactId}</artifactId>
> <version>1</version>
> <type>${project.packaging}</type>
> </artifactItem>
> 
> This only happens with Maven 2.1.0. Maven 2.0.10 does not replace 
> ${project.version}. This is really weird because ${project.version} is 
> used in other places throughout the pom (e. g. jar plugin config), 
> where it is not replaced. Is there some special treatment to the version tag?
> 
> Should I open a JIRA for this?
> 
> Reinhard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For 
> additional commands, e-mail: dev-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [Fwd: Weird property replacement issue in Maven 2.1.0]

Posted by John Casey <jd...@commonjava.org>.
Thanks for filing this. It seems like the issue is related to a new 
interpolation step that takes place to transform version expression 
references in things like dependencies just before a POM is deployed. It 
looks like the profile information got caught in the crossfire.

Reinhard Nägele wrote:
> Hello,
> 
> Unfortunately, I got no response on the user list, so I'm forwarding 
> this to the dev list now. I think this is a critical regression and 
> opened a JIRA ticket for it.
> 
> http://jira.codehaus.org/browse/MNG-4140
> 
> Reinhard
> 
> -------- Original-Nachricht --------
> Betreff:     Weird property replacement issue in Maven 2.1.0
> Datum:     Wed, 15 Apr 2009 13:39:12 +0200
> Von:     Reinhard Nägele <re...@mgm-tp.com>
> Antwort an:     Maven Users List <us...@maven.apache.org>
> An:     Maven Users List <us...@maven.apache.org>
> 
> 
> Hello,
> 
> I guess I spotted a bug in Maven 2.1.0. In a pom, which is intended to 
> be used as a parent pom, we have the following profile. The profile is 
> used to copy artifacts to Luntbuild's publish directory.
> 
> <profile>
> <id>luntbuild</id>
> <build>
>   <plugins>
>     <plugin>
>       <artifactId>maven-dependency-plugin</artifactId>
>       <executions>
>         <execution>
>           <id>copy</id>
>           <phase>deploy</phase>
>           <goals>
>             <goal>copy</goal>
>           </goals>
>           <configuration>
>             <artifactItems>
>               <artifactItem>
>                 <groupId>${project.groupId}</groupId>
>                 <artifactId>${project.artifactId}</artifactId>
>                 <version>${project.version}</version>
>                 <type>${project.packaging}</type>
>               </artifactItem>
>             </artifactItems>
>             <outputDirectory>${artifactsDir}</outputDirectory>
>           </configuration>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>
> </profile>
> 
> When I deploy the pom, ${project.version} is replaced with the pom's 
> version (1 in this case) and ends up in Nexus as follows:
> 
> <artifactItem>
> <groupId>${project.groupId}</groupId>
> <artifactId>${project.artifactId}</artifactId>
> <version>1</version>
> <type>${project.packaging}</type>
> </artifactItem>
> 
> This only happens with Maven 2.1.0. Maven 2.0.10 does not replace 
> ${project.version}. This is really weird because ${project.version} is 
> used in other places throughout the pom (e. g. jar plugin config), where 
> it is not replaced. Is there some special treatment to the version tag?
> 
> Should I open a JIRA for this?
> 
> Reinhard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org