[MNG-6306] Replace use of Guava in maven-resolver-provider with a lighter weight alternative
This closes #138 Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/866582d2 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/866582d2 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/866582d2 Branch: refs/heads/MNG-5227 Commit: 866582d296ed80f36f33e5293cd07647185e0e43 Parents: 909fb7c Author: Sylwester Lachiewicz <slachiew...@gmail.com> Authored: Fri Nov 24 20:38:10 2017 +0100 Committer: Michael Osipov <micha...@apache.org> Committed: Fri Nov 24 23:55:19 2017 +0100 ---------------------------------------------------------------------- maven-resolver-provider/pom.xml | 4 ---- .../repository/internal/DefaultModelResolver.java | 14 +++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/866582d2/maven-resolver-provider/pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-provider/pom.xml b/maven-resolver-provider/pom.xml index 4aff64c..5cd835c 100644 --- a/maven-resolver-provider/pom.xml +++ b/maven-resolver-provider/pom.xml @@ -71,10 +71,6 @@ under the License. <artifactId>javax.inject</artifactId> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> <classifier>no_aop</classifier> http://git-wip-us.apache.org/repos/asf/maven/blob/866582d2/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java ---------------------------------------------------------------------- diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java index 3e82eb9..03a0d9b 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java @@ -23,11 +23,10 @@ import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Set; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; import org.apache.maven.model.Dependency; import org.apache.maven.model.Parent; import org.apache.maven.model.Repository; @@ -145,14 +144,15 @@ class DefaultModelResolver private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id ) { - Iterables.removeIf( repositories, new Predicate<RemoteRepository>() + Iterator<RemoteRepository> iterator = repositories.iterator(); + while ( iterator.hasNext() ) { - @Override - public boolean apply( RemoteRepository remoteRepository ) + RemoteRepository remoteRepository = iterator.next(); + if ( remoteRepository.getId().equals( id ) ) { - return remoteRepository.getId().equals( id ); + iterator.remove(); } - } ); + } } @Override