Index: maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java =================================================================== --- maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java (revision 708522) +++ maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java (working copy) @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -75,7 +75,7 @@ public static Map artifactMapByVersionlessId( Collection artifacts ) { - Map artifactMap = new HashMap(); + Map artifactMap = new LinkedHashMap(); if ( artifacts != null ) { @@ -92,7 +92,7 @@ public static Map artifactMapByArtifactId( Collection artifacts ) { - Map artifactMap = new HashMap(); + Map artifactMap = new LinkedHashMap(); if ( artifacts != null ) { Index: maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java =================================================================== --- maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java (revision 0) +++ maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java (revision 0) @@ -0,0 +1,82 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.maven.artifact.versioning.VersionRange; + +import junit.framework.TestCase; + +/** + * Tests {@link ArtifactUtils}. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class ArtifactUtilsTest + extends TestCase +{ + + /** + * Tests that the ordering of the map resembles the ordering of the input collection of artifacts. + */ + public void testArtifactMapByArtifactIdOrdering() + throws Exception + { + List list = new ArrayList(); + list.add( newArtifact( "b" ) ); + list.add( newArtifact( "a" ) ); + list.add( newArtifact( "c" ) ); + list.add( newArtifact( "e" ) ); + list.add( newArtifact( "d" ) ); + + Map map = ArtifactUtils.artifactMapByArtifactId( list ); + assertNotNull( map ); + assertEquals( list, new ArrayList( map.values() ) ); + } + + /** + * Tests that the ordering of the map resembles the ordering of the input collection of artifacts. + */ + public void testArtifactMapByVersionlessIdOrdering() + throws Exception + { + List list = new ArrayList(); + list.add( newArtifact( "b" ) ); + list.add( newArtifact( "a" ) ); + list.add( newArtifact( "c" ) ); + list.add( newArtifact( "e" ) ); + list.add( newArtifact( "d" ) ); + + Map map = ArtifactUtils.artifactMapByVersionlessId( list ); + assertNotNull( map ); + assertEquals( list, new ArrayList( map.values() ) ); + } + + private Artifact newArtifact( String aid ) + { + return new DefaultArtifact( "org.apache.maven.ut", aid, VersionRange.createFromVersion( "1.0" ), "test", "jar", + "tests", null ); + } + +} Property changes on: maven-artifact\src\test\java\org\apache\maven\artifact\ArtifactUtilsTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Index: maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java =================================================================== --- maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java (revision 708522) +++ maven-core/src/main/java/org/apache/maven/extension/DefaultExtensionManager.java (working copy) @@ -23,8 +23,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.jar.JarFile; @@ -121,9 +121,10 @@ // not declare plexus-utils but need it. MNG-2900 DefaultPluginManager.checkPlexusUtils( resolutionGroup, artifactFactory ); - Set dependencies = new HashSet( resolutionGroup.getArtifacts() ); + Set dependencies = new LinkedHashSet(); dependencies.add( artifact ); + dependencies.addAll( resolutionGroup.getArtifacts() ); // Make sure that we do not influence the dependenecy resolution of extensions with the project's // dependencyManagement Index: maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java =================================================================== --- maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (revision 708522) +++ maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (working copy) @@ -89,7 +89,6 @@ import java.util.Collections; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; @@ -1627,7 +1626,7 @@ List plugins ) throws ProjectBuildingException { - Set pluginArtifacts = new HashSet(); + Set pluginArtifacts = new LinkedHashSet(); for ( Iterator i = plugins.iterator(); i.hasNext(); ) { @@ -1670,7 +1669,7 @@ List reports ) throws ProjectBuildingException { - Set pluginArtifacts = new HashSet(); + Set pluginArtifacts = new LinkedHashSet(); if ( reports != null ) { @@ -1716,7 +1715,7 @@ List extensions ) throws ProjectBuildingException { - Set extensionArtifacts = new HashSet(); + Set extensionArtifacts = new LinkedHashSet(); if ( extensions != null ) {