geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r700026 - /geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
Date Mon, 29 Sep 2008 08:26:28 GMT
Author: jdillon
Date: Mon Sep 29 01:26:28 2008
New Revision: 700026

URL: http://svn.apache.org/viewvc?rev=700026&view=rev
Log:
Add some logging to expose some more details when resolve() fails

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java?rev=700026&r1=700025&r2=700026&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
Mon Sep 29 01:26:28 2008
@@ -25,6 +25,8 @@
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.CyclicDependencyException;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.wagon.events.TransferListener;
 import org.codehaus.plexus.component.annotations.Component;
@@ -32,6 +34,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 /**
  * Default implementation of the {@link ArtifactManager} component.
  *
@@ -115,16 +119,69 @@
 
         log.debug("Validating result: {}", result);
 
-        if (result.hasErrorArtifactExceptions() ||
-            result.hasCircularDependencyExceptions() ||
-            result.hasMetadataResolutionExceptions() ||
-            result.hasVersionRangeViolations() ||
-            !result.getMissingArtifacts().isEmpty())
-        {
-            // Puke
-            throw new ResolutionException(request, result);
+        boolean failed = false;
+
+        if (result.hasErrorArtifactExceptions()) {
+            failed = true;
+
+            log.error("Artifact resolution errors:");
+            List<ArtifactResolutionException> exceptions = result.getErrorArtifactExceptions();
+            for (ArtifactResolutionException exception : exceptions) {
+                log.error("    {}", exception);
+                log.trace("Artifact resolution error", exception);
+            }
         }
 
+        if (result.hasCircularDependencyExceptions()) {
+            failed = true;
+
+            log.error("Artifact circular dependency errors:");
+            List<CyclicDependencyException> exceptions = result.getCircularDependencyExceptions();
+            for (CyclicDependencyException exception : exceptions) {
+                log.error("    {}", exception);
+                log.trace("Artifact circular dependency error", exception);
+            }
+        }
+
+        if (result.hasMetadataResolutionExceptions()) {
+            failed = true;
+
+            log.error("Artifact metadata resolution errors:");
+            // noinspection unchecked
+            List<ArtifactResolutionException> exceptions = result.getMetadataResolutionExceptions();
+            for (ArtifactResolutionException exception : exceptions) {
+                log.error("    {}", exception);
+                log.trace("Artifact metadata resolution error", exception);
+            }
+        }
+
+        if (result.hasVersionRangeViolations()) {
+            failed = true;
+
+            log.error("Artifact version range violations:");
+            // noinspection unchecked
+            List<Exception> exceptions = result.getVersionRangeViolations();
+            for (Exception exception : exceptions) {
+                log.error("    {}", exception);
+                log.trace("Artifact version range violation", exception);
+            }
+        }
+
+        // noinspection unchecked
+        List<Artifact> artifacts = result.getMissingArtifacts();
+        if (!artifacts.isEmpty()) {
+            failed = true;
+
+            log.error("Missing artifacts:");
+            for (Artifact artifact : artifacts) {
+                log.error("    {}", artifact);
+            }
+        }
+
+        if (failed) {
+            throw new ResolutionException(request, result);
+        }
+        
         return result;
     }
 }
\ No newline at end of file



Mime
View raw message