mirror of https://github.com/apache/maven.git
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:
parent
1d340a10f4
commit
ab27ae65a7
|
@ -34,6 +34,8 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach a POM to an artifact.
|
* Attach a POM to an artifact.
|
||||||
|
@ -85,10 +87,17 @@ public class ProjectArtifactMetadata
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reader = new FileReader( file );
|
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 );
|
writer = new FileWriter( destination );
|
||||||
|
|
||||||
MavenXpp3Reader modelReader = new MavenXpp3Reader();
|
MavenXpp3Reader modelReader = new MavenXpp3Reader();
|
||||||
Model model = modelReader.read( reader );
|
Model model = modelReader.read( sReader );
|
||||||
model.setVersion( artifact.getVersion() );
|
model.setVersion( artifact.getVersion() );
|
||||||
|
|
||||||
DistributionManagement distributionManagement = model.getDistributionManagement();
|
DistributionManagement distributionManagement = model.getDistributionManagement();
|
||||||
|
|
Loading…
Reference in New Issue