From fa03325f35771cd16c99a7ba0c08ec86b5852d1d Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sun, 24 May 2009 13:16:45 +0000 Subject: [PATCH] o Fixed artifact resolver to deliver root artifact first to retain class path order git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@778141 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/artifact/resolver/ArtifactResolutionResult.java | 5 +++++ .../maven/artifact/resolver/DefaultArtifactResolver.java | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java index a9d1ce8cf5..1f6854b028 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java @@ -89,6 +89,11 @@ public class ArtifactResolutionResult return ( artifacts != null ) ? artifacts : Collections. emptySet(); } + public void setArtifacts( Set artifacts ) + { + this.artifacts = artifacts; + } + public void addRequestedArtifact( Artifact artifact ) { if ( requestedArtifacts == null ) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index d28d7d0cc6..9b99568f16 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -515,8 +515,11 @@ public class DefaultArtifactResolver // have been resolved. if ( request.isResolveRoot() && !isDummy( request ) ) { - // Add the root artifact - result.addArtifact( rootArtifact ); + // Add the root artifact (as the first artifact to retain logical order of class path!) + Set allArtifacts = new LinkedHashSet(); + allArtifacts.add( rootArtifact ); + allArtifacts.addAll( result.getArtifacts() ); + result.setArtifacts( allArtifacts ); } return result;