diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index 318247b36a..ac15f0b55c 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -515,7 +515,7 @@ public class DefaultPluginManager getLogger().warn( "Mojo: " + mojoDescriptor.getGoal() + " is deprecated.\n" + mojoDescriptor.getDeprecated() ); } - Model model = ModelUtils.cloneModel( project.getModel() ); + Model model = project.getModel(); pathTranslator.alignToBaseDirectory( model, project.getBasedir() ); project.setBuild( model.getBuild() ); diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 72a9799d2a..dd23d163a2 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -196,7 +196,7 @@ public class DefaultMavenProjectBuilder superModel.setVersion( STANDALONE_SUPERPOM_VERSION ); - superModel = ModelUtils.cloneModel( superModel ); + superModel = superModel; ProfileManager profileManager = config.getGlobalProfileManager(); diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index 9cf9a2cce8..126cfc0a93 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -203,7 +203,7 @@ public class MavenProject this.artifactFactory = artifactFactory; this.mavenProjectBuilder = mavenProjectBuilder; this.projectBuilderConfiguration = projectBuilderConfiguration; - originalModel = ModelUtils.cloneModel( model ); + originalModel = model; DistributionManagement dm = model.getDistributionManagement(); if ( dm != null ) @@ -1980,11 +1980,11 @@ public class MavenProject setScriptSourceRoots( ( new ArrayList( project.getScriptSourceRoots() ) ) ); } - setModel( ( ModelUtils.cloneModel( project.getModel() ) ) ); + setModel( project.getModel() ); if ( project.getOriginalModel() != null ) { - setOriginalModel( ( ModelUtils.cloneModel( project.getOriginalModel() ) ) ); + setOriginalModel( project.getOriginalModel() ); } setExecutionRoot( project.isExecutionRoot() ); diff --git a/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java b/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java index 1cb753ae88..3b03232dd5 100644 --- a/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java +++ b/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java @@ -20,10 +20,8 @@ package org.apache.maven.project; */ import org.apache.maven.model.*; -import org.apache.maven.project.builder.PomClassicDomainModel; import org.codehaus.plexus.util.xml.Xpp3Dom; -import java.io.IOException; import java.util.*; public final class ModelUtils @@ -312,16 +310,6 @@ public final class ModelUtils child.setConfiguration( childConfiguration ); } - public static Model cloneModel( Model model ) - { - try { - return new PomClassicDomainModel(model).getModel(); - } catch (IOException e) { - e.printStackTrace(); - return model; - } - } - public static List mergeRepositoryLists( List dominant, List recessive ) { List repositories = new ArrayList();