maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r803816 - in /maven/components/trunk/maven-core/src/main/java/org/apache/maven/project: DefaultProjectBuilder.java MavenProject.java
Date Thu, 13 Aug 2009 09:32:15 GMT
Author: bentmann
Date: Thu Aug 13 09:32:14 2009
New Revision: 803816

URL: http://svn.apache.org/viewvc?rev=803816&view=rev
Log:
o Cleaned up code

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java?rev=803816&r1=803815&r2=803816&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Thu Aug 13 09:32:14 2009
@@ -87,8 +87,8 @@
         return build( pomFile, true, configuration, false );
     }
 
-    private DefaultProjectBuildingResult build( File pomFile, boolean localProject,
-                                                ProjectBuildingRequest configuration, boolean
resolveDependencies )
+    private ProjectBuildingResult build( File pomFile, boolean localProject, ProjectBuildingRequest
configuration,
+                                         boolean resolveDependencies )
         throws ProjectBuildingException
     {
         ModelBuildingRequest request = getModelBuildingRequest( configuration, null );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=803816&r1=803815&r2=803816&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
Thu Aug 13 09:32:14 2009
@@ -17,8 +17,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -64,7 +62,7 @@
 import org.apache.maven.model.Repository;
 import org.apache.maven.model.Resource;
 import org.apache.maven.model.Scm;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.building.ModelUtils;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
@@ -1840,27 +1838,9 @@
             setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots()
) ) );
         }
 
-        /*
-         * 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 );
-            }
+            setModel( ModelUtils.cloneModel( project.getModel() ) );
         }
 
         if ( project.getOriginalModel() != null )



Mime
View raw message