Decoupling ${version} expressions from POM version before resolving it to a buildnumber/timestamp on install or deploy.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@344386 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-11-15 16:15:21 +00:00
parent 1d340a10f4
commit ab27ae65a7
1 changed files with 10 additions and 1 deletions

View File

@ -34,6 +34,8 @@ import java.io.FileNotFoundException;
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 @@ public class ProjectArtifactMetadata
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();