maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-plugin/src/test/java/org/apache/maven/plugin TestPlugin.java TestPluginTest.java
Date Sun, 20 Mar 2005 23:22:02 GMT
brett       2005/03/20 15:22:02

  Modified:    maven-core/src/main/java/org/apache/maven/execution
                        MavenExecutionResponse.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        DefaultLifecycleExecutor.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java PluginManager.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
               maven-core/src/test/java/org/apache/maven/plugin
                        GoalDecorationAndResolutionTestPlugin.java
                        IntegratedPlugin.java
               maven-plugin/src/main/java/org/apache/maven/plugin
                        AbstractPlugin.java FailureResponse.java
                        Plugin.java PluginExecutionResponse.java
                        PluginTestCase.java
               maven-plugin/src/test/java/org/apache/maven/plugin
                        TestPlugin.java TestPluginTest.java
  Added:       maven-plugin/src/main/java/org/apache/maven/plugin
                        PluginExecutionException.java
  Removed:     maven-core/src/main/java/org/apache/maven/lifecycle
                        GoalExecutionException.java
                        GoalNotFoundException.java
  Log:
  change the plugin execution response to be an exception instead since it only handled failures.
  any returns from success will be conveyed by the request, soon to be converted into fields
on the plugin. These will eventually be extracted using OGNL, but this is all post alpha-1
work
  
  Revision  Changes    Path
  1.4       +2 -35     maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResponse.java
  
  Index: MavenExecutionResponse.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResponse.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenExecutionResponse.java	25 Dec 2004 16:26:24 -0000	1.3
  +++ MavenExecutionResponse.java	20 Mar 2005 23:22:01 -0000	1.4
  @@ -17,8 +17,6 @@
    * ====================================================================
    */
   
  -import org.apache.maven.plugin.FailureResponse;
  -
   import java.util.Date;
   
   /**
  @@ -27,10 +25,6 @@
    */
   public class MavenExecutionResponse
   {
  -    private String failedGoal;
  -
  -    private FailureResponse failureResponse;
  -
       private Throwable exception;
   
       private Date start;
  @@ -41,36 +35,9 @@
       // Execution failure
       // ----------------------------------------------------------------------
   
  -    public void setExecutionFailure( String failedGoal, FailureResponse response )
  -    {
  -        this.failedGoal = failedGoal;
  -
  -        this.failureResponse = response;
  -    }
  -
       public boolean isExecutionFailure()
       {
  -        return ( failedGoal != null || exception != null );
  -    }
  -
  -    public String getFailedGoal()
  -    {
  -        return failedGoal;
  -    }
  -
  -    public void setFailedGoal( String failedGoal )
  -    {
  -        this.failedGoal = failedGoal;
  -    }
  -
  -    public FailureResponse getFailureResponse()
  -    {
  -        return failureResponse;
  -    }
  -
  -    public void setFailureResponse( FailureResponse failureResponse )
  -    {
  -        this.failureResponse = failureResponse;
  +        return ( exception != null );
       }
   
       // ----------------------------------------------------------------------
  
  
  
  1.28      +22 -42    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
  
  Index: DefaultLifecycleExecutor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DefaultLifecycleExecutor.java	17 Mar 2005 02:26:19 -0000	1.27
  +++ DefaultLifecycleExecutor.java	20 Mar 2005 23:22:01 -0000	1.28
  @@ -26,7 +26,7 @@
   import org.apache.maven.model.PluginManagement;
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.event.MavenEvents;
  -import org.apache.maven.plugin.PluginExecutionResponse;
  +import org.apache.maven.plugin.PluginExecutionException;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.plugin.descriptor.PluginDescriptor;
  @@ -76,6 +76,7 @@
        * @param session
        */
       public MavenExecutionResponse execute( List tasks, MavenSession session )
  +        throws LifecycleExecutionException
       {
           MavenExecutionResponse response = new MavenExecutionResponse();
   
  @@ -132,27 +133,22 @@
   
                   if ( phaseMap.containsKey( task ) )
                   {
  -                    executePhase( task, session, response, phaseMap );
  +                    executePhase( task, session, phaseMap );
                   }
                   else
                   {
  -                    PluginExecutionResponse pluginResponse = executeMojo( task, session
);
  -
  -                    if ( pluginResponse.isExecutionFailure() )
  -                    {
  -                        response.setExecutionFailure( task, pluginResponse.getFailureResponse()
);
  -                    }
  -                }
  -                if ( response.isExecutionFailure() )
  -                {
  -                    break;
  +                    executeMojo( task, session );
                   }
               }
           }
  -        catch ( Exception e )
  +        catch ( PluginExecutionException e )
           {
               response.setException( e );
           }
  +        catch ( Exception e )
  +        {
  +            throw new LifecycleExecutionException( "Error during lifecycle execution",
e );
  +        }
           finally
           {
               response.setFinish( new Date() );
  @@ -210,7 +206,6 @@
        * @param mavenSession
        * @throws Exception
        */
  -    // TODO: don't throw Exception
       private void processPluginPhases( Plugin plugin, MavenSession mavenSession, Map phaseMap
)
           throws Exception
       {
  @@ -337,8 +332,8 @@
           configureMojo( mojoDescriptor, phaseMap );
       }
   
  -    private void executePhase( String phase, MavenSession session, MavenExecutionResponse
response, Map phaseMap )
  -        throws LifecycleExecutionException
  +    private void executePhase( String phase, MavenSession session, Map phaseMap )
  +        throws PluginExecutionException
       {
           // only execute up to the given phase
           int index = phases.indexOf( phaseMap.get( phase ) );
  @@ -364,31 +359,22 @@
                       {
                           String goal = (String) i.next();
   
  -                        PluginExecutionResponse pluginResponse = executeMojo( goal, session
);
  -
  -                        if ( pluginResponse.isExecutionFailure() )
  -                        {
  -                            response.setExecutionFailure( goal, pluginResponse.getFailureResponse()
);
  -
  -                            return;
  -                        }
  +                        executeMojo( goal, session );
                       }
                   }
  -
  -                dispatcher.dispatchEnd( event, p.getId() );
               }
  -            catch ( LifecycleExecutionException e )
  +            catch ( PluginExecutionException e )
               {
                   dispatcher.dispatchError( event, p.getId(), e );
  -
                   throw e;
               }
  -            // End event monitoring.
  +
  +            dispatcher.dispatchEnd( event, p.getId() );
           }
       }
   
  -    protected PluginExecutionResponse executeMojo( String id, MavenSession session )
  -        throws LifecycleExecutionException
  +    protected void executeMojo( String id, MavenSession session )
  +        throws PluginExecutionException
       {
           // ----------------------------------------------------------------------
           // We have something of the form <pluginId>:<mojoId>, so this might
be
  @@ -399,18 +385,12 @@
           // archetype:create
           // ----------------------------------------------------------------------
   
  -        try
  -        {
  -            Logger logger = getLogger();
  -            logger.debug( "Resolving artifacts from:\n" + "\t{localRepository: " + session.getLocalRepository()
+
  -                          "}\n" + "\t{remoteRepositories: " + session.getRemoteRepositories()
+ "}" );
  +        Logger logger = getLogger();
  +        logger.debug( "Resolving artifacts from:" );
  +        logger.debug( "\t{localRepository: " + session.getLocalRepository() + "}" );
  +        logger.debug( "\t{remoteRepositories: " + session.getRemoteRepositories() + "}"
);
   
  -            return pluginManager.executeMojo( session, id );
  -        }
  -        catch ( GoalExecutionException e )
  -        {
  -            throw new LifecycleExecutionException( "Problem executing " + id, e );
  -        }
  +        pluginManager.executeMojo( session, id );
       }
   
       // ----------------------------------------------------------------------
  
  
  
  1.58      +22 -27    maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
  
  Index: DefaultPluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- DefaultPluginManager.java	19 Mar 2005 00:22:28 -0000	1.57
  +++ DefaultPluginManager.java	20 Mar 2005 23:22:01 -0000	1.58
  @@ -27,7 +27,6 @@
   import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
   import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
   import org.apache.maven.execution.MavenSession;
  -import org.apache.maven.lifecycle.GoalExecutionException;
   import org.apache.maven.model.Goal;
   import org.apache.maven.model.Repository;
   import org.apache.maven.monitor.event.EventDispatcher;
  @@ -318,8 +317,8 @@
       // Plugin execution
       // ----------------------------------------------------------------------
   
  -    public PluginExecutionResponse executeMojo( MavenSession session, String goalName )
  -        throws GoalExecutionException
  +    public void executeMojo( MavenSession session, String goalName )
  +        throws PluginExecutionException
       {
           try
           {
  @@ -327,7 +326,7 @@
           }
           catch ( Exception e )
           {
  -            throw new GoalExecutionException( "Unable to execute goal: " + goalName, e
);
  +            throw new PluginExecutionException( "Unable to execute goal: " + goalName,
e );
           }
   
           PluginExecutionRequest request;
  @@ -337,7 +336,7 @@
           MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );
           if ( mojoDescriptor == null )
           {
  -            throw new GoalExecutionException( "Unable to find goal: " + goalName );
  +            throw new PluginExecutionException( "Unable to find goal: " + goalName );
           }
   
           try
  @@ -372,7 +371,7 @@
           }
           catch ( Exception e )
           {
  -            throw new GoalExecutionException( "Unable to resolve required dependencies
for goal", e );
  +            throw new PluginExecutionException( "Unable to resolve required dependencies
for goal", e );
           }
   
           try
  @@ -383,11 +382,9 @@
           }
           catch ( PluginConfigurationException e )
           {
  -            throw new GoalExecutionException( "Error configuring plugin for execution.",
e );
  +            throw new PluginExecutionException( "Error configuring plugin for execution.",
e );
           }
   
  -        response = new PluginExecutionResponse();
  -
           Plugin plugin = null;
   
           try
  @@ -402,31 +399,36 @@
               dispatcher.dispatchStart( event, goalName );
               try
               {
  -                plugin.execute( request, response );
  +                plugin.execute( request );
   
                   dispatcher.dispatchEnd( event, goalName );
               }
  -            catch ( Exception e )
  +            catch ( PluginExecutionException e )
               {
                   session.getEventDispatcher().dispatchError( event, goalName, e );
                   throw e;
               }
               // End event monitoring.
   
  -            releaseComponents( mojoDescriptor, request );
  -
  -            container.release( plugin );
           }
           catch ( ComponentLookupException e )
           {
  -            throw new GoalExecutionException( "Error looking up plugin: ", e );
  +            throw new PluginExecutionException( "Error looking up plugin: ", e );
           }
  -        catch ( Exception e )
  +        finally
           {
  -            throw new GoalExecutionException( "Error executing plugin: ", e );
  -        }
  +            try
  +            {
  +                releaseComponents( mojoDescriptor, request );
   
  -        return response;
  +                container.release( plugin );
  +            }
  +            catch ( Exception e )
  +            {
  +                // TODO: better error handling, needed!
  +                e.printStackTrace();
  +            }
  +        }
       }
   
       // TODO: don't throw Exception
  @@ -651,21 +653,14 @@
       // ----------------------------------------------------------------------
   
       private void downloadDependencies( MavenSession context, ArtifactResolver artifactResolver
)
  -        throws GoalExecutionException
  +        throws ArtifactResolutionException
       {
  -        try
  -        {
               for ( Iterator it = context.getProject().getArtifacts().iterator(); it.hasNext();
)
               {
                   Artifact artifact = (Artifact) it.next();
   
                   artifactResolver.resolve( artifact, context.getRemoteRepositories(), context.getLocalRepository()
);
               }
  -        }
  -        catch ( ArtifactResolutionException e )
  -        {
  -            throw new GoalExecutionException( "Can't resolve artifact: ", e );
  -        }
       }
   
   }
  
  
  
  1.18      +3 -4      maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PluginManager.java	10 Mar 2005 01:35:14 -0000	1.17
  +++ PluginManager.java	20 Mar 2005 23:22:01 -0000	1.18
  @@ -18,7 +18,6 @@
    */
   
   import org.apache.maven.execution.MavenSession;
  -import org.apache.maven.lifecycle.GoalExecutionException;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.plugin.descriptor.PluginDescriptor;
   
  @@ -30,8 +29,8 @@
   {
       String ROLE = PluginManager.class.getName();
   
  -    PluginExecutionResponse executeMojo( MavenSession session, String goalName )
  -        throws GoalExecutionException;
  +    void executeMojo( MavenSession session, String goalName )
  +        throws PluginExecutionException;
   
       MojoDescriptor getMojoDescriptor( String goalId );
   
  
  
  
  1.40      +11 -9     maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- DefaultMaven.java	18 Mar 2005 22:02:09 -0000	1.39
  +++ DefaultMaven.java	20 Mar 2005 23:22:01 -0000	1.40
  @@ -27,6 +27,7 @@
   import org.apache.maven.model.Repository;
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.event.MavenEvents;
  +import org.apache.maven.plugin.PluginExecutionException;
   import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  @@ -223,7 +224,12 @@
           // TODO: is this perhaps more appropriate in the CLI?
           if ( response.isExecutionFailure() )
           {
  -            if ( response.getException() != null )
  +            // TODO: yuck! Revisit when cleaning up the exception handling from the top
down
  +            if ( response.getException() instanceof PluginExecutionException )
  +            {
  +                logFailure( response, (PluginExecutionException) response.getException()
);
  +            }
  +            else
               {
                   // TODO: this should be a "FATAL" exception, reported to the
                   // developers - however currently a LOT of
  @@ -231,10 +237,6 @@
                   // one example)
                   logError( response );
               }
  -            else
  -            {
  -                logFailure( response );
  -            }
           }
           else
           {
  @@ -336,7 +338,7 @@
           line();
       }
   
  -    protected void logFailure( MavenExecutionResponse r )
  +    protected void logFailure( MavenExecutionResponse r, PluginExecutionException e )
       {
           line();
   
  @@ -344,11 +346,11 @@
   
           line();
   
  -        getLogger().info( "Reason: " + r.getFailureResponse().shortMessage() );
  +        getLogger().info( "Reason: " + e.getMessage() );
   
           line();
   
  -        getLogger().info( r.getFailureResponse().longMessage() );
  +        getLogger().info( e.getLongMessage() );
   
           line();
   
  
  
  
  1.3       +1 -1      maven-components/maven-core/src/test/java/org/apache/maven/plugin/GoalDecorationAndResolutionTestPlugin.java
  
  Index: GoalDecorationAndResolutionTestPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/GoalDecorationAndResolutionTestPlugin.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GoalDecorationAndResolutionTestPlugin.java	5 Dec 2004 04:16:05 -0000	1.2
  +++ GoalDecorationAndResolutionTestPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  @@ -9,7 +9,7 @@
   
       private boolean executed = false;
   
  -    public void execute(PluginExecutionRequest request, PluginExecutionResponse response)
throws Exception {
  +    public void execute(PluginExecutionRequest request) throws PluginExecutionException
{
           this.executed = true;
       }
       
  
  
  
  1.3       +3 -3      maven-components/maven-core/src/test/java/org/apache/maven/plugin/IntegratedPlugin.java
  
  Index: IntegratedPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/IntegratedPlugin.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntegratedPlugin.java	5 Dec 2004 04:16:05 -0000	1.2
  +++ IntegratedPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  @@ -27,8 +27,8 @@
       extends AbstractTestPlugin
       implements Plugin
   {
  -    public void execute( PluginExecutionRequest request, PluginExecutionResponse response
)
  -        throws Exception
  +    public void execute( PluginExecutionRequest request )
  +        throws PluginExecutionException
       {
           name = (String) request.getParameter( "name" );
   
  
  
  
  1.3       +30 -2     maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java
  
  Index: AbstractPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractPlugin.java	25 Feb 2005 03:14:49 -0000	1.2
  +++ AbstractPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  @@ -1,7 +1,7 @@
   package org.apache.maven.plugin;
   
   /*
  - * Copyright 2001-2004 The Apache Software Foundation.
  + * Copyright 2001-2005 The Apache Software Foundation.
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -16,8 +16,36 @@
    * limitations under the License.
    */
   
  -/** @todo: what purpose does this serve? */
   public abstract class AbstractPlugin
       implements Plugin
   {
  +    /**
  +     * Default behaviour to mimic old behaviour.
  +     */
  +    public void execute( PluginExecutionRequest request )
  +        throws PluginExecutionException
  +    {
  +        PluginExecutionResponse response = new PluginExecutionResponse();
  +        try
  +        {
  +            execute( request, response );
  +        }
  +        catch ( Exception e )
  +        {
  +            throw new PluginExecutionException( e.getMessage(), e );
  +        }
  +        if ( response.isExecutionFailure() )
  +        {
  +            throw new PluginExecutionException( response.getFailureResponse().getSource(),
  +                                                response.getFailureResponse().shortMessage(),
  +                                                response.getFailureResponse().longMessage()
);
  +        }
  +    }
  +
  +    /**
  +     * @deprecated
  +     */
  +    public abstract void execute( PluginExecutionRequest request, PluginExecutionResponse
response )
  +        throws Exception;
  +
   }
  
  
  
  1.2       +6 -1      maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/FailureResponse.java
  
  Index: FailureResponse.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/FailureResponse.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FailureResponse.java	9 Aug 2004 18:49:35 -0000	1.1
  +++ FailureResponse.java	20 Mar 2005 23:22:01 -0000	1.2
  @@ -32,4 +32,9 @@
       public abstract String shortMessage();
   
       public abstract String longMessage();
  +
  +    public Object getSource()
  +    {
  +        return source;
  +    }
   }
  
  
  
  1.4       +3 -4      maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java
  
  Index: Plugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Plugin.java	1 Mar 2005 07:05:32 -0000	1.3
  +++ Plugin.java	20 Mar 2005 23:22:01 -0000	1.4
  @@ -24,8 +24,7 @@
   {
       String ROLE = Plugin.class.getName();
   
  -    // TODO: return response.getFailureResponse now as that is the only member of it?
       // TODO: make this throw PluginExecutionException instead of generic exception
  -    void execute( PluginExecutionRequest request, PluginExecutionResponse response )
  -        throws Exception;
  +    void execute( PluginExecutionRequest request )
  +        throws PluginExecutionException;
   }
  
  
  
  1.3       +2 -1      maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionResponse.java
  
  Index: PluginExecutionResponse.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionResponse.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PluginExecutionResponse.java	25 Feb 2005 03:14:49 -0000	1.2
  +++ PluginExecutionResponse.java	20 Mar 2005 23:22:01 -0000	1.3
  @@ -17,6 +17,7 @@
    */
   
   /**
  + * @deprecated
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
  
  
  
  1.2       +2 -6      maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginTestCase.java
  
  Index: PluginTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PluginTestCase.java	9 Aug 2004 18:49:36 -0000	1.1
  +++ PluginTestCase.java	20 Mar 2005 23:22:01 -0000	1.2
  @@ -31,8 +31,6 @@
   
       protected PluginExecutionRequest request;
   
  -    protected PluginExecutionResponse response;
  -
       protected String basedir;
   
       // ----------------------------------------------------------------------
  @@ -92,9 +90,7 @@
   
           request = new PluginExecutionRequest( getTestParameters() );
   
  -        response = new PluginExecutionResponse();
  -
  -        plugin.execute( request, response );
  +        plugin.execute( request );
   
           validatePluginExecution();
       }
  
  
  
  1.1                  maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
  
  Index: PluginExecutionException.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2005 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * A failure or exception occuring during the execution of a plugin.
   *
   * @author Brett Porter
   * @version $Id: PluginExecutionException.java,v 1.1 2005/03/20 23:22:01 brett Exp $
   */
  public class PluginExecutionException extends Exception
  {
      private Object source;
  
      private String longMessage;
  
      public PluginExecutionException( Object source, String shortMessage, String longMessage
)
      {
          super( shortMessage );
          this.source = source;
          this.longMessage = longMessage;
      }
  
      public PluginExecutionException( String message, Exception cause )
      {
          super( message, cause );
      }
  
      public PluginExecutionException( String message )
      {
          super( message );
      }
  
      public String getLongMessage()
      {
          return longMessage;
      }
  }
  
  
  
  1.2       +3 -3      maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/TestPlugin.java
  
  Index: TestPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/TestPlugin.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPlugin.java	9 Aug 2004 18:49:36 -0000	1.1
  +++ TestPlugin.java	20 Mar 2005 23:22:01 -0000	1.2
  @@ -54,8 +54,8 @@
           return foo;
       }
   
  -    public void execute( PluginExecutionRequest request, PluginExecutionResponse response
)
  -        throws Exception
  +    public void execute( PluginExecutionRequest request )
  +        throws PluginExecutionException
       {
           name = (String) request.getParameter( "name" );
   
  
  
  
  1.2       +3 -5      maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/TestPluginTest.java
  
  Index: TestPluginTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/TestPluginTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPluginTest.java	9 Aug 2004 18:49:36 -0000	1.1
  +++ TestPluginTest.java	20 Mar 2005 23:22:01 -0000	1.2
  @@ -18,8 +18,8 @@
   
   import junit.framework.TestCase;
   
  -import java.util.Map;
   import java.util.HashMap;
  +import java.util.Map;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -43,9 +43,7 @@
   
           PluginExecutionRequest request = new PluginExecutionRequest( parameters );
   
  -        PluginExecutionResponse response = new PluginExecutionResponse();
  -
  -        plugin.execute( request, response );
  +        plugin.execute( request );
   
           assertTrue( plugin.hasExecuted() );
   
  
  
  

Mime
View raw message