From 70ae109093708c87866a6ab1a29abfb0a83e29bc Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 17 Jul 2009 21:07:11 +0000 Subject: [PATCH] o Added method to clone/fork model resolver which is a prerequisite for importing other POMs/mixins during the model building where the model builder basically recurses and we want the resolution processes for these sub POMs to be isolated git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@795227 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/project/RepositoryModelResolver.java | 6 ++++++ .../org/apache/maven/model/resolution/ModelResolver.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java b/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java index 898b79edf6..8f44927c08 100644 --- a/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java +++ b/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java @@ -82,6 +82,12 @@ class RepositoryModelResolver this.remoteRepositories = new ArrayList( remoteRepositories ); } + public ModelResolver newCopy() + { + return new RepositoryModelResolver( repositorySystem, resolutionErrorHandler, localRepository, + remoteRepositories ); + } + public void addRepository( Repository repository ) throws InvalidRepositoryException { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java b/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java index 6488d993bc..09480a1921 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java @@ -55,4 +55,13 @@ public interface ModelResolver void addRepository( Repository repository ) throws InvalidRepositoryException; + /** + * Clones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep + * clone. The only requirement is that invocations of {@link #addRepository(Repository)} on the clone do not affect + * the state of the original resolver and vice versa. + * + * @return The cloned resolver, never {@code null}. + */ + ModelResolver newCopy(); + }