maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r778161 - in /maven/components/branches/MNG-2766/maven-compat/src: main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
Date Sun, 24 May 2009 14:35:25 GMT
Author: bentmann
Date: Sun May 24 14:35:25 2009
New Revision: 778161

URL: http://svn.apache.org/viewvc?rev=778161&view=rev
Log:
o Restored original behavior of legacy resolution methods (every client and not just Surefire
that calls the old methods expects the root artifact to not be resolved as in 2.x now)

Modified:
    maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
    maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java

Modified: maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?rev=778161&r1=778160&r2=778161&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
(original)
+++ maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
Sun May 24 14:35:25 2009
@@ -329,6 +329,7 @@
     {
         ArtifactResolutionRequest request = new ArtifactResolutionRequest()
             .setArtifact( originatingArtifact )
+            .setResolveRoot( false )
             // This is required by the surefire plugin
             .setArtifactDependencies( artifacts )            
             .setManagedVersionMap( managedVersions )
@@ -357,11 +358,6 @@
     // ------------------------------------------------------------------------
     //
     // ------------------------------------------------------------------------
-
-    private boolean isDummy( ArtifactResolutionRequest request )
-    {
-        return request.getArtifact().getArtifactId().equals( "dummy" ) && request.getArtifact().getGroupId().equals(
"dummy" );        
-    }
     
     public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
     {
@@ -386,15 +382,7 @@
                 // won't happen
             }
         }
-        
-        // This is an extreme hack because of the ridiculous APIs we have a root that is
disconnected and
-        // useless. The SureFire plugin passes in a dummy root artifact that is actually
used in the production
-        // plugin ... We have no choice but to put this hack in the core.
-        if ( isDummy( request ) )
-        {
-            request.setResolveRoot( false );
-        }
-                
+
         if ( listeners == null )
         {
             listeners = new ArrayList<ResolutionListener>();
@@ -513,7 +501,7 @@
                 
         // We want to send the root artifact back in the result but we need to do this after
the other dependencies
         // have been resolved.
-        if ( request.isResolveRoot() && !isDummy( request ) )
+        if ( request.isResolveRoot() )
         {
             // Add the root artifact (as the first artifact to retain logical order of class
path!)
             Set<Artifact> allArtifacts = new LinkedHashSet<Artifact>();

Modified: maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java?rev=778161&r1=778160&r2=778161&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
(original)
+++ maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
Sun May 24 14:35:25 2009
@@ -113,7 +113,7 @@
 
         ArtifactResolutionResult result = artifactResolver.resolveTransitively( Collections.singleton(
g ), projectArtifact, remoteRepositories(), localRepository(), null );
 
-        assertEquals( 3, result.getArtifacts().size() );
+        assertEquals( 2, result.getArtifacts().size() );
 
         assertTrue( result.getArtifacts().contains( g ) );
 
@@ -135,7 +135,7 @@
 
         ArtifactResolutionResult result = artifactResolver.resolveTransitively( Collections.singleton(
i ), projectArtifact, remoteRepositories(), localRepository(), null );
 
-        assertEquals( 3, result.getArtifacts().size() );
+        assertEquals( 2, result.getArtifacts().size() );
 
         assertTrue( result.getArtifacts().contains( i ) );
 
@@ -231,7 +231,6 @@
             artifactResolver.resolveTransitively( set, projectArtifact, remoteRepositories(),
localRepository(), mds );
 
         Iterator i = result.getArtifacts().iterator();
-        i.next();
         assertEquals( "n should be first", n, i.next() );
         assertEquals( "m should be second", m, i.next() );
 
@@ -244,7 +243,6 @@
             artifactResolver.resolveTransitively( set, projectArtifact, remoteRepositories(),
localRepository(), mds );
 
         i = result.getArtifacts().iterator();
-        i.next();
         assertEquals( "m should be first", m, i.next() );
         assertEquals( "n should be second", n, i.next() );
     }



Mime
View raw message