Author: jdcasey Date: Wed Mar 7 18:11:22 2007 New Revision: 515892 URL: http://svn.apache.org/viewvc?view=rev&rev=515892 Log: Fleshing out the removeAll() method in LifecycleUtils.
Modified: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java Modified: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java?view=diff&rev=515892&r1=515891&r2=515892 ============================================================================== --- maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java (original) +++ maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java Wed Mar 7 18:11:22 2007 @@ -192,7 +192,30 @@ public static void removeBindings( List toRemove, List removeFrom ) { - // remove where g:a:v:goal matches. + // remove where gid:aid:goal matches. + List targets = new ArrayList(); + for ( Iterator it = toRemove.iterator(); it.hasNext(); ) + { + MojoBinding binding = (MojoBinding) it.next(); + + targets.add( createMojoBindingKey( binding ) ); + } + + for ( Iterator it = removeFrom.iterator(); it.hasNext(); ) + { + MojoBinding binding = (MojoBinding) it.next(); + + String key = createMojoBindingKey( binding ); + if ( targets.contains( key ) ) + { + it.remove(); + } + } + } + + public static String createMojoBindingKey( MojoBinding mojoBinding ) + { + return mojoBinding.getGroupId() + ":" + mojoBinding.getArtifactId() + ":" + mojoBinding.getGoal(); } }