mirror of https://github.com/apache/maven.git
o Restored isolation of model in forked lifecycle
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@749738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c151f2925f
commit
3e7be3ad1f
|
@ -17,6 +17,8 @@ package org.apache.maven.project;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -64,6 +66,7 @@ import org.apache.maven.model.Reporting;
|
||||||
import org.apache.maven.model.Repository;
|
import org.apache.maven.model.Repository;
|
||||||
import org.apache.maven.model.Resource;
|
import org.apache.maven.model.Resource;
|
||||||
import org.apache.maven.model.Scm;
|
import org.apache.maven.model.Scm;
|
||||||
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||||
import org.apache.maven.project.artifact.ActiveProjectArtifact;
|
import org.apache.maven.project.artifact.ActiveProjectArtifact;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||||
|
@ -2041,7 +2044,28 @@ public class MavenProject
|
||||||
setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots() ) ) );
|
setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots() ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
setModel( project.getModel() );
|
/*
|
||||||
|
* TODO: This is temporary solution for the failure of IT mng-0471. When StartForkedExecutionMojo clones the
|
||||||
|
* project it really needs a deep copy of the model to make sure manipulations to the project/model during the
|
||||||
|
* forked execution don't pollute the main execution. It's not clear to me right now whether manipulations to
|
||||||
|
* the model itself should just be prohibited (say be means of UnsupportedOperationExceptions) and only have the
|
||||||
|
* project be mutable. If we allow model updates like in 2.x, the code below should better be replaced with the
|
||||||
|
* original cloning code from ModelUtils.
|
||||||
|
*/
|
||||||
|
if ( project.getModel() != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringWriter modelWriter = new StringWriter( 1024 * 10 );
|
||||||
|
project.writeModel( modelWriter );
|
||||||
|
MavenXpp3Reader parser = new MavenXpp3Reader();
|
||||||
|
setModel( parser.read( new StringReader( modelWriter.toString() ) ) );
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
throw new IllegalStateException( "in-memory cloning failed", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( project.getOriginalModel() != null )
|
if ( project.getOriginalModel() != null )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue