maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r751512 - in /maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven: lifecycle/DefaultLifecycleExecutor.java plugin/DefaultPluginManager.java plugin/PluginManager.java
Date Sun, 08 Mar 2009 20:07:40 GMT
Author: jvanzyl
Date: Sun Mar  8 20:07:40 2009
New Revision: 751512

URL: http://svn.apache.org/viewvc?rev=751512&view=rev
Log:
o reduce the signature of executeMojo in the pluginManager and propagate

Modified:
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=751512&r1=751511&r2=751512&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Sun Mar  8 20:07:40 2009
@@ -54,7 +54,6 @@
 import org.apache.maven.plugin.lifecycle.Execution;
 import org.apache.maven.plugin.lifecycle.Phase;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.reporting.MavenReport;
 import org.apache.maven.settings.Settings;
 import org.codehaus.plexus.component.annotations.Component;
@@ -577,18 +576,6 @@
             {
                 throw new LifecycleExecutionException( "Internal error in the plugin manager
executing goal '" + mojoDescriptor.getId() + "': " + e.getMessage(), e );
             }
-            catch ( ArtifactNotFoundException e )
-            {
-                throw new LifecycleExecutionException( e.getMessage(), e );
-            }
-            catch ( InvalidDependencyVersionException e )
-            {
-                throw new LifecycleExecutionException( e.getMessage(), e );
-            }
-            catch ( ArtifactResolutionException e )
-            {
-                throw new LifecycleExecutionException( e.getMessage(), e );
-            }
             catch ( MojoFailureException e )
             {
                 throw new BuildFailureException( e.getMessage(), e );

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=751512&r1=751511&r2=751512&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Sun Mar  8 20:07:40 2009
@@ -414,7 +414,7 @@
     // ----------------------------------------------------------------------
 
     public void executeMojo( MavenProject project, MojoExecution mojoExecution, MavenSession
session )
-        throws ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
+        throws MojoFailureException, PluginExecutionException, PluginConfigurationException
     {
         MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
@@ -454,14 +454,32 @@
                 projects = Collections.singleton( project );
             }
 
-            for ( Iterator i = projects.iterator(); i.hasNext(); )
+            //!!jvz What is this? We resolveTransitiveDependencies() and then a line later
downDependencies()? That can't be right. We should also already
+            // know at this point that what we need to execute can't be found. This is the
wrong time to find this out.
+            
+            try
             {
-                MavenProject p = (MavenProject) i.next();
+                for ( Iterator i = projects.iterator(); i.hasNext(); )
+                {
+                    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 );
+                downloadDependencies( project, session, repositorySystem );
+            }
+            catch ( ArtifactResolutionException e )
+            {
+                throw new PluginExecutionException( mojoExecution, project, e.getMessage()
);                
+            }
+            catch ( InvalidDependencyVersionException e )
+            {
+                throw new PluginExecutionException( mojoExecution, project, e.getMessage()
);                
+            }
+            catch ( ArtifactNotFoundException e )
+            {
+                throw new PluginExecutionException( mojoExecution, project, e.getMessage()
);                
+            }
         }
 
         String goalName = mojoDescriptor.getFullGoalName();
@@ -486,11 +504,11 @@
             }
             catch ( XmlPullParserException e )
             {
-                throw new PluginManagerException( mojoDescriptor, project, "Failed to calculate
concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey(), e );
+                throw new PluginExecutionException( mojoExecution, project, "Failed to calculate
concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey() );
             }
             catch ( IOException e )
             {
-                throw new PluginManagerException( mojoDescriptor, project, "Failed to calculate
concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey(), e );
+                throw new PluginExecutionException( mojoExecution, project, "Failed to calculate
concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey() );
             }
         }
 
@@ -594,6 +612,12 @@
 
             throw e;
         }
+        catch ( PluginManagerException e )
+        {
+            session.getEventDispatcher().dispatchError( event, goalExecId, e );
+
+            throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
           
+        }
         finally
         {
             if ( mojo != null )

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java?rev=751512&r1=751511&r2=751512&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
Sun Mar  8 20:07:40 2009
@@ -31,8 +31,8 @@
 public interface PluginManager
 {
     // - find the plugin [extension point: any client may wish to do whatever they choose]
-    // - load the plugin [extension point: we want to take them from a repository, some may
take from disk or whatever]
-    // - configure the plugin 
+    // - load the plugin into a classloader [extension point: we want to take them from a
repository, some may take from disk or whatever]
+    // - configure the plugin [extension point]
     // - execute the plugin    
     
     Plugin findPluginForPrefix( String prefix, MavenProject project, MavenSession session
);
@@ -40,10 +40,8 @@
     PluginDescriptor loadPlugin( Plugin plugin, MavenProject project, MavenSession session
)
         throws PluginLoaderException;
     
-    //!!jvz
-    // Clean up the exceptions returned. We should not be coupled to the repository layer.
We need to generalize to allow a general plugin mechanism.
     void executeMojo( MavenProject project, MojoExecution execution, MavenSession session
)
-        throws ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException;
+        throws MojoFailureException, PluginExecutionException, PluginConfigurationException;
         
     //!!jvz 
     // Reporting    



Mime
View raw message