maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r749535 - in /maven/components/trunk: maven-compat/src/main/java/org/apache/maven/artifact/resolver/ maven-core/src/main/java/org/apache/maven/plugin/
Date Tue, 03 Mar 2009 05:35:38 GMT
Author: jvanzyl
Date: Tue Mar  3 05:35:38 2009
New Revision: 749535

URL: http://svn.apache.org/viewvc?rev=749535&view=rev
Log:
o if there was no metadata resolved then don't try to resolve artifacts

Modified:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java?rev=749535&r1=749534&r2=749535&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
Tue Mar  3 05:35:38 2009
@@ -164,6 +164,7 @@
         StringBuffer sb = new StringBuffer()
                 .append( "REQUEST: " ).append(  "\n" )
                 .append( "artifact: " ).append( artifact ).append(  "\n" )
+                .append( artifactDependencies ).append(  "\n" )
                 .append( "localRepository: " ).append(  localRepository ).append(  "\n" )
                 .append( "remoteRepositories: " ).append(  remoteRepositories ).append( 
"\n" )
                 .append( "metadataSource: " ).append(  metadataSource ).append(  "\n" );

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?rev=749535&r1=749534&r2=749535&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
(original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
Tue Mar  3 05:35:38 2009
@@ -46,7 +46,7 @@
 /**
  * @author Jason van Zyl
  */
-@Component(role=ArtifactResolver.class)
+@Component(role = ArtifactResolver.class)
 public class DefaultArtifactResolver
     extends AbstractLogEnabled
     implements ArtifactResolver
@@ -66,7 +66,7 @@
 
     @Requirement
     private ArtifactCollector artifactCollector;
-    
+
     // ----------------------------------------------------------------------
     // Implementation
     // ----------------------------------------------------------------------
@@ -83,8 +83,7 @@
         resolve( artifact, remoteRepositories, localRepository, true );
     }
 
-    private void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
-                          ArtifactRepository localRepository, boolean force )
+    private void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, boolean force )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         if ( artifact == null )
@@ -104,14 +103,12 @@
 
             if ( !systemFile.exists() )
             {
-                throw new ArtifactNotFoundException( "System artifact: " + artifact + " not
found in path: "
-                    + systemFile, artifact );
+                throw new ArtifactNotFoundException( "System artifact: " + artifact + " not
found in path: " + systemFile, artifact );
             }
 
             if ( !systemFile.isFile() )
             {
-                throw new ArtifactNotFoundException( "System artifact: " + artifact + " is
not a file: " + systemFile,
-                                                     artifact );
+                throw new ArtifactNotFoundException( "System artifact: " + artifact + " is
not a file: " + systemFile, artifact );
             }
 
             artifact.setResolved( true );
@@ -133,7 +130,7 @@
             boolean localCopy = isLocalCopy( artifact );
 
             destination = artifact.getFile();
-                             
+
             boolean resolved = false;
 
             // There are three conditions in which we'll go after the artifact here:
@@ -158,8 +155,7 @@
 
                     if ( !artifact.isResolved() && !destination.exists() )
                     {
-                        throw new ArtifactResolutionException(
-                                                               "Failed to resolve artifact,
possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",
+                        throw new ArtifactResolutionException( "Failed to resolve artifact,
possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",
                                                                artifact, remoteRepositories
);
                     }
                 }
@@ -200,8 +196,7 @@
                     }
                     catch ( IOException e )
                     {
-                        throw new ArtifactResolutionException( "Unable to copy resolved artifact
for local use: "
-                            + e.getMessage(), artifact, remoteRepositories, e );
+                        throw new ArtifactResolutionException( "Unable to copy resolved artifact
for local use: " + e.getMessage(), artifact, remoteRepositories, e );
                     }
                 }
 
@@ -291,26 +286,19 @@
     }
 
     public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact
originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
-                                                          List<ArtifactRepository>
remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener>
listeners,
-                                                          List<ConflictResolver> conflictResolvers
)
+                                                         List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
+                                                         List<ConflictResolver> conflictResolvers
)
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
-        ArtifactResolutionRequest request = new ArtifactResolutionRequest()
-        .setArtifact( originatingArtifact )
-        .setArtifactDependencies( artifacts )
-        .setManagedVersionMap( managedVersions )
-        .setLocalRepository( localRepository )
-        .setRemoteRepostories( remoteRepositories )
-        .setMetadataSource( source )
-        .setFilter( filter )
-        .setListeners( listeners );
-        
+        ArtifactResolutionRequest request = new ArtifactResolutionRequest().setArtifact(
originatingArtifact ).setArtifactDependencies( artifacts ).setManagedVersionMap( managedVersions
)
+            .setLocalRepository( localRepository ).setRemoteRepostories( remoteRepositories
).setMetadataSource( source ).setFilter( filter ).setListeners( listeners );
+
         return resolveWithExceptions( request );
     }
-    
+
     public ArtifactResolutionResult resolveWithExceptions( ArtifactResolutionRequest request
)
         throws ArtifactResolutionException, ArtifactNotFoundException
-    {            
+    {
         ArtifactResolutionResult result = resolve( request );
 
         // We have collected all the problems so let's mimic the way the old code worked
and just blow up right here.
@@ -366,7 +354,7 @@
         if ( listeners == null )
         {
             listeners = new ArrayList<ResolutionListener>();
-            
+
             if ( getLogger().isDebugEnabled() )
             {
                 listeners.add( new DebugResolutionListener( getLogger() ) );
@@ -374,15 +362,15 @@
 
             listeners.add( new WarningResolutionListener( getLogger() ) );
         }
-                
+
         if ( request.getArtifactDependencies() == null || request.getArtifactDependencies().size()
== 0 )
         {
             ArtifactResolutionResult result = new ArtifactResolutionResult();
-            
+
             try
             {
                 resolve( request.getArtifact(), request.getRemoteRepostories(), request.getLocalRepository()
);
-                
+
                 result.addArtifact( request.getArtifact() );
             }
             catch ( ArtifactResolutionException e )
@@ -393,10 +381,10 @@
             {
                 result.addMissingArtifact( request.getArtifact() );
             }
-            
+
             return result;
         }
-        
+
         // After the collection we will have the artifact object in the result but they will
not be resolved yet.
         ArtifactResolutionResult result = artifactCollector.collect( artifacts, originatingArtifact,
managedVersions, localRepository, remoteRepositories, source, filter, listeners );
 
@@ -413,27 +401,30 @@
             return result;
         }
 
-        for ( Artifact requestedArtifact : result.getRequestedArtifacts() )
+        if ( result.getArtifacts() != null )
         {
-            try
-            {
-                resolve( requestedArtifact, remoteRepositories, localRepository );
-                
-                result.addArtifact( requestedArtifact );
-            }
-            catch ( ArtifactNotFoundException anfe )
+            for ( Artifact artifact : result.getArtifacts() )
             {
-                // These are cases where the artifact just isn't present in any of the remote
repositories
-                // because it wasn't deployed, or it was deployed in the wrong place.
+                try
+                {
+                    resolve( artifact, remoteRepositories, localRepository );
 
-                result.addMissingArtifact( requestedArtifact );                         
     
-            }
-            catch ( ArtifactResolutionException e )
-            {
-                // This is really a wagon TransferFailedException so something went wrong
after we successfully
-                // retrieved the metadata.
+                    result.addArtifact( artifact );
+                }
+                catch ( ArtifactNotFoundException anfe )
+                {
+                    // These are cases where the artifact just isn't present in any of the
remote repositories
+                    // because it wasn't deployed, or it was deployed in the wrong place.
 
-                result.addErrorArtifactException( e );
+                    result.addMissingArtifact( artifact );
+                }
+                catch ( ArtifactResolutionException e )
+                {
+                    // This is really a wagon TransferFailedException so something went wrong
after we successfully
+                    // retrieved the metadata.
+
+                    result.addErrorArtifactException( e );
+                }
             }
         }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=749535&r1=749534&r2=749535&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Tue Mar  3 05:35:38 2009
@@ -542,11 +542,7 @@
             {
                 MavenProject p = (MavenProject) i.next();
 
-                resolveTransitiveDependencies( session,
-                                               repositorySystem,
-                                               mojoDescriptor.isDependencyResolutionRequired(),
-                                               p,
-                                               mojoDescriptor.isAggregator() );
+                resolveTransitiveDependencies( session, repositorySystem, mojoDescriptor.isDependencyResolutionRequired(),
p, mojoDescriptor.isAggregator() );
             }
 
             downloadDependencies( project, session, repositorySystem );
@@ -1473,18 +1469,14 @@
     // ----------------------------------------------------------------------
 
     protected void resolveTransitiveDependencies( MavenSession context,
-                                                MavenRepositorySystem repositorySystem,
-                                                String scope,
-                                                MavenProject project,
-                                                boolean isAggregator )
-        throws ArtifactResolutionException, ArtifactNotFoundException,
-        InvalidDependencyVersionException
+                                                  MavenRepositorySystem repositorySystem,
+                                                  String scope,
+                                                  MavenProject project,
+                                                  boolean isAggregator )
+        throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException
     {
         // TODO: such a call in MavenMetadataSource too - packaging not really the intention
of type
-        Artifact artifact = repositorySystem.createBuildArtifact( project.getGroupId(),
-                                                                 project.getArtifactId(),
-                                                                 project.getVersion(),
-                                                                 project.getPackaging() );
+        Artifact artifact = repositorySystem.createBuildArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion(), project.getPackaging() );
 
         // TODO: we don't need to resolve over and over again, as long as we are sure that
the parameters are the same
         // check this with yourkit as a hot spot.
@@ -1498,25 +1490,21 @@
             }
             catch ( VersionNotFoundException e )
             {
-                InvalidDependencyVersionException ee = new InvalidDependencyVersionException(
e.getProjectId(), e.getDependency(), e.getPomFile(), e.getCauseException() );
-                
-                throw ee;
+                throw new InvalidDependencyVersionException( e.getProjectId(), e.getDependency(),
e.getPomFile(), e.getCauseException() );
             }
         }
 
         ArtifactFilter filter = new ScopeArtifactFilter( scope );
 
         ArtifactResolutionRequest request = new ArtifactResolutionRequest()
-            .setArtifact( project.getArtifact() )
+            .setArtifact( artifact )
             .setArtifactDependencies( project.getDependencyArtifacts() )
             .setLocalRepository( context.getLocalRepository() )
             .setRemoteRepostories( project.getRemoteArtifactRepositories() )
             .setManagedVersionMap( project.getManagedVersionMap() )
             .setFilter( filter )                
             .setMetadataSource( repositorySystem );
-                 
-        Set resolvedArtifacts;
-        
+                         
         ArtifactResolutionResult result = repositorySystem.resolve( request );
 
         if ( result.hasErrorArtifactExceptions() )
@@ -1530,7 +1518,6 @@
             */
             if ( isAggregator && checkMissingArtifactsInReactor( context.getSortedProjects(),
result.getMissingArtifacts() ) )
             {
-                resolvedArtifacts = new LinkedHashSet( result.getArtifacts() );
             }
             else
             {



Mime
View raw message