maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r769580 - in /maven/components/branches/MNG-2766: maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/execution/ maven-embedder/src/m...
Date Tue, 28 Apr 2009 23:04:25 GMT
Author: jvanzyl
Date: Tue Apr 28 23:04:24 2009
New Revision: 769580

URL: http://svn.apache.org/viewvc?rev=769580&view=rev
Log:
o pushing my changes back in with shane's

Modified:
    maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
    maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

Modified: maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java?rev=769580&r1=769579&r2=769580&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
(original)
+++ maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
Tue Apr 28 23:04:24 2009
@@ -21,9 +21,6 @@
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * Metadata for the group directory of the repository.
  *

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=769580&r1=769579&r2=769580&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
Tue Apr 28 23:04:24 2009
@@ -23,16 +23,16 @@
 import java.util.List;
 
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.exception.DefaultExceptionHandler;
+import org.apache.maven.exception.ExceptionHandler;
+import org.apache.maven.exception.ExceptionSummary;
 import org.apache.maven.execution.DefaultMavenExecutionResult;
 import org.apache.maven.execution.DuplicateProjectException;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.RuntimeInformation;
-import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
@@ -98,25 +98,22 @@
         try
         {
             lifecycleExecutor.execute( session );
-        }
-        catch ( LifecycleExecutionException e )
-        {
-            result.addException( e );
-
-            return result;
-        }
-        catch ( MojoFailureException e )
-        {
+        }        
+        catch ( Exception e )
+        {            
+            ExceptionHandler handler = new DefaultExceptionHandler();
+            
+            // This will only be more then one if we have fail at end on and we collect
+            // them per project.
+            ExceptionSummary es = handler.handleException( result.getExceptions().get( 0
) );                        
+         
             result.addException( e );
 
+            result.setExceptionSummary( es );
+            
             return result;
         }
-        catch ( MojoExecutionException e )
-        {
-            result.addException( e );
 
-            return result;
-        }
         result.setTopologicallySortedProjects( session.getReactorManager().getSortedProjects()
);
 
         result.setProject( session.getReactorManager().getTopLevelProject() );

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java?rev=769580&r1=769579&r2=769580&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
Tue Apr 28 23:04:24 2009
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.exception.ExceptionSummary;
 import org.apache.maven.project.MavenProject;
 
 /** @author Jason van Zyl */
@@ -40,6 +41,8 @@
 
     private ReactorManager reactorManager;
 
+    private ExceptionSummary exceptionSummary;
+    
     public MavenExecutionResult setProject( MavenProject project )
     {
         this.project = project;
@@ -109,4 +112,16 @@
 
         return this;
     }
+
+    public MavenExecutionResult setExceptionSummary( ExceptionSummary exceptionSummary )
+    {
+        this.exceptionSummary = exceptionSummary;
+
+        return this;
+    }
+    
+    public ExceptionSummary getExceptionSummary()
+    {
+        return exceptionSummary;
+    }
 }

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java?rev=769580&r1=769579&r2=769580&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
Tue Apr 28 23:04:24 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.exception.ExceptionSummary;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -51,4 +52,7 @@
     MavenExecutionResult addException( Throwable e );
 
     boolean hasExceptions();
+        
+    MavenExecutionResult setExceptionSummary( ExceptionSummary exceptionSummary );
+    ExceptionSummary getExceptionSummary();
 }

Modified: maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=769580&r1=769579&r2=769580&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
(original)
+++ maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Tue Apr 28 23:04:24 2009
@@ -20,7 +20,6 @@
  */
 
 import java.io.File;
-import java.util.List;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
@@ -34,8 +33,6 @@
 import org.apache.maven.embedder.MavenEmbedderLogger;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
-import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.plugin.MojoFailureException;
 import org.codehaus.plexus.classworlds.ClassWorld;
 
 /**
@@ -148,6 +145,7 @@
 
         MavenEmbedder mavenEmbedder;
         MavenEmbedderLogger logger;
+        
         try
         {
             mavenEmbedder = new MavenEmbedder( configuration );
@@ -167,26 +165,13 @@
         }
 
         MavenExecutionResult result = mavenEmbedder.execute( request );
-
-        //CLIReportingUtils.logResult( request, result, logger );
-
-        System.out.println( "exceptions: " + result.hasExceptions() );
-        
-        System.out.println( result.getExceptions() );
-        
-        Exception e = result.getExceptions().get( 0 );
         
-        if ( e instanceof MojoFailureException )
-        {
-            System.out.println( ((MojoFailureException)e).getLongMessage() );
-        }
-        else
-        {
-            System.out.println( e.getMessage() );
-        }
+        // The exception handling should be handled in Maven itself.
         
         if ( result.hasExceptions() )
         {
+            System.out.println( result.getExceptionSummary().getMessage() );
+            
             return 1;
         }
         else



Mime
View raw message