maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r344386 - /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
Date Tue, 15 Nov 2005 16:15:28 GMT
Author: jdcasey
Date: Tue Nov 15 08:15:21 2005
New Revision: 344386

URL: http://svn.apache.org/viewcvs?rev=344386&view=rev
Log:
Decoupling ${version} expressions from POM version before resolving it to a buildnumber/timestamp
on install or deploy.

Modified:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java?rev=344386&r1=344385&r2=344386&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
Tue Nov 15 08:15:21 2005
@@ -34,6 +34,8 @@
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
 
 /**
  * Attach a POM to an artifact.
@@ -85,10 +87,17 @@
         try
         {
             reader = new FileReader( file );
+            StringWriter sWriter = new StringWriter();
+            IOUtil.copy( reader, sWriter );
+            
+            String modelSrc = sWriter.toString().replaceAll( "\\$\\{(pom\\.|project\\.)?version\\}",
artifact.getBaseVersion() );
+            
+            StringReader sReader = new StringReader( modelSrc );
+            
             writer = new FileWriter( destination );
 
             MavenXpp3Reader modelReader = new MavenXpp3Reader();
-            Model model = modelReader.read( reader );
+            Model model = modelReader.read( sReader );
             model.setVersion( artifact.getVersion() );
 
             DistributionManagement distributionManagement = model.getDistributionManagement();



Mime
View raw message