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
Date Mon, 21 Mar 2005 00:07:39 GMT
brett       2005/03/20 16:07:39

  Modified:    maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean
                        CleanPlugin.java
               maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin
                        CompilerMojo.java
               maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy
                        AbstractDeployMojo.java
               maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war
                        WarMojo.java
               maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom
                        PomDeployMojo.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java
               maven-core/src/test/java/org/apache/maven/plugin
                        GoalDecorationAndResolutionTestPlugin.java
                        IntegratedPlugin.java
               maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb
                        EjbMojo.java
               maven-plugin/src/main/java/org/apache/maven/plugin
                        AbstractPlugin.java Plugin.java
                        PluginExecutionRequest.java
               maven-plugin/src/test/java/org/apache/maven/plugin
                        TestPlugin.java
  Log:
  move log to AbstractPlugin, out of request. Request now contains only parameters (will move
to fields) and marmalade context (can move to marmalade mojo wrapper)
  
  Revision  Changes    Path
  1.4       +4 -14     maven-components/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java
  
  Index: CleanPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CleanPlugin.java	4 Mar 2005 09:04:15 -0000	1.3
  +++ CleanPlugin.java	21 Mar 2005 00:07:38 -0000	1.4
  @@ -16,7 +16,6 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.monitor.logging.Log;
   import org.apache.maven.plugin.AbstractPlugin;
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
  @@ -48,8 +47,6 @@
   
       private boolean failOnError;
   
  -    private Log log;
  -
       public void execute( PluginExecutionRequest request, PluginExecutionResponse response
)
           throws Exception
       {
  @@ -59,15 +56,13 @@
   
               failOnError = Boolean.valueOf( (String) request.getParameter( "failedOnError"
) ).booleanValue();
               
  -            log = request.getLog();
  -
               if ( outputDirectory != null )
               {
                   File dir = new File( outputDirectory );
   
                   if ( dir.exists() && dir.isDirectory() )
                   {
  -                    log( "Deleting directory " + dir.getAbsolutePath() );
  +                    getLog().info( "Deleting directory " + dir.getAbsolutePath() );
                       removeDir( dir );
                   }
               }
  @@ -77,7 +72,6 @@
               // clean up state.
               failOnError = false;
               outputDirectory = null;
  -            log = null;
           }
       }
   
  @@ -140,7 +134,7 @@
                       }
                       else
                       {
  -                        log( message );
  +                        getLog().info( message );
                       }
                   }
               }
  @@ -156,13 +150,9 @@
               }
               else
               {
  -                log( message );
  +                getLog().info( message );
               }
           }
       }
   
  -    private void log( String message )
  -    {
  -        log.info( message );
  -    }
   }
  
  
  
  1.23      +3 -3      maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java
  
  Index: CompilerMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CompilerMojo.java	12 Mar 2005 06:10:37 -0000	1.22
  +++ CompilerMojo.java	21 Mar 2005 00:07:39 -0000	1.23
  @@ -88,7 +88,7 @@
           compileSourceRoots = removeEmptyCompileSourceRoots( compileSourceRoots );
           if ( compileSourceRoots.isEmpty() )
           {
  -            request.getLog().info( "No sources to compile" );
  +            getLog().info( "No sources to compile" );
               return;
           }
   
  @@ -140,7 +140,7 @@
                       message = "Warning! not present in repository!";
                   }
   
  -                request.getLog().debug( "classpathElements[ " + i + " ] = " + classpathElement
+ ": " + message );
  +                getLog().debug( "classpathElements[ " + i + " ] = " + classpathElement
+ ": " + message );
               }
           }
   
  
  
  
  1.9       +2 -2      maven-components/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
  
  Index: AbstractDeployMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractDeployMojo.java	16 Mar 2005 06:29:34 -0000	1.8
  +++ AbstractDeployMojo.java	21 Mar 2005 00:07:39 -0000	1.9
  @@ -105,7 +105,7 @@
           
           if(deploymentRepository.getAuthenticationInfo() == null)
           {
  -            request.getLog().warn("Deployment repository {id: \'" + repository.getId()
+ "\'} has no associated authentication info!");
  +            getLog().warn("Deployment repository {id: \'" + repository.getId() + "\'} has
no associated authentication info!");
           }
   
           // Deploy the POM
  
  
  
  1.10      +4 -5      maven-components/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
  
  Index: WarMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WarMojo.java	10 Mar 2005 09:53:47 -0000	1.9
  +++ WarMojo.java	21 Mar 2005 00:07:39 -0000	1.10
  @@ -174,7 +174,7 @@
       {
           if ( sourceDirectory != webappDirectory )
           {
  -            request.getLog().info( "Copy webapp resources to " + webappDirectory.getAbsolutePath()
);
  +            getLog().info( "Copy webapp resources to " + webappDirectory.getAbsolutePath()
);
   
               if ( warSourceDirectory.exists() )
               {
  @@ -195,8 +195,7 @@
       public void buildWebapp( MavenProject project )
           throws IOException
       {
  -        request.getLog().info(
  -            "Assembling webapp " + project.getArtifactId() + " in " + webappDirectory.getAbsolutePath()
);
  +        getLog().info( "Assembling webapp " + project.getArtifactId() + " in " + webappDirectory.getAbsolutePath()
);
   
           File libDirectory = new File( webappDirectory, WEB_INF + "/lib" );
   
  @@ -272,7 +271,7 @@
               if ( !"exploded".equals( mode ) )
               {
                   //generate war file
  -                request.getLog().info( "Generating war " + warFile.getAbsolutePath() );
  +                getLog().info( "Generating war " + warFile.getAbsolutePath() );
   
                   MavenArchiver archiver = new MavenArchiver();
   
  
  
  
  1.8       +1 -1      maven-components/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java
  
  Index: PomDeployMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PomDeployMojo.java	16 Mar 2005 06:29:35 -0000	1.7
  +++ PomDeployMojo.java	21 Mar 2005 00:07:39 -0000	1.8
  @@ -92,7 +92,7 @@
   
           if ( deploymentRepository.getAuthenticationInfo() == null )
           {
  -            request.getLog().warn(
  +            getLog().warn(
                   "Deployment repository {id: \'" + repository.getId() + "\'} has no associated
authentication info!" );
           }
   
  
  
  
  1.59      +2 -2      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.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- DefaultPluginManager.java	20 Mar 2005 23:22:01 -0000	1.58
  +++ DefaultPluginManager.java	21 Mar 2005 00:07:39 -0000	1.59
  @@ -377,8 +377,6 @@
           try
           {
               request = new PluginExecutionRequest( createParameters( mojoDescriptor, session
) );
  -
  -            request.setLog( session.getLog() );
           }
           catch ( PluginConfigurationException e )
           {
  @@ -391,6 +389,8 @@
           {
               plugin = (Plugin) container.lookup( Plugin.ROLE, goalName );
   
  +            plugin.setLog( session.getLog() );
  +
               // !! This is ripe for refactoring to an aspect.
               // Event monitoring.
               String event = MavenEvents.MOJO_EXECUTION;
  
  
  
  1.4       +26 -2     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GoalDecorationAndResolutionTestPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  +++ GoalDecorationAndResolutionTestPlugin.java	21 Mar 2005 00:07:39 -0000	1.4
  @@ -1,6 +1,23 @@
  -/* Created on Jul 18, 2004 */
   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.
  + */
  +
  +import org.apache.maven.monitor.logging.Log;
  +
   /**
    * @author jdcasey
    */
  @@ -9,10 +26,17 @@
   
       private boolean executed = false;
   
  +    private Log log;
  +
       public void execute(PluginExecutionRequest request) throws PluginExecutionException
{
           this.executed = true;
       }
  -    
  +
  +    public void setLog( Log log )
  +    {
  +        this.log = log;
  +    }
  +
       public boolean executed() {
           return executed;
       }
  
  
  
  1.4       +10 -1     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntegratedPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  +++ IntegratedPlugin.java	21 Mar 2005 00:07:39 -0000	1.4
  @@ -16,6 +16,8 @@
    * limitations under the License.
    */
   
  +import org.apache.maven.monitor.logging.Log;
  +
   /**
    *
    * 
  @@ -27,6 +29,8 @@
       extends AbstractTestPlugin
       implements Plugin
   {
  +    private Log log;
  +
       public void execute( PluginExecutionRequest request )
           throws PluginExecutionException
       {
  @@ -38,4 +42,9 @@
   
           executed = true;
       }
  +
  +    public void setLog( Log log )
  +    {
  +        this.log = log;
  +    }
   }
  
  
  
  1.2       +3 -3      maven-components/maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
  
  Index: EjbMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EjbMojo.java	10 Mar 2005 17:14:39 -0000	1.1
  +++ EjbMojo.java	21 Mar 2005 00:07:39 -0000	1.2
  @@ -132,7 +132,7 @@
           //
           // ----------------------------------------------------------------------
   
  -        request.getLog().info( "Building ejb " + jarName );
  +        getLog().info( "Building ejb " + jarName );
   
           File jarFile = new File( basedir, jarName + ".jar" );
   
  @@ -152,7 +152,7 @@
   
           if ( generateClient )
           {
  -            request.getLog().info( "Building ejb client " + jarName + "-client" );
  +            getLog().info( "Building ejb client " + jarName + "-client" );
   
               File clientJarFile = new File( basedir, jarName + "-client.jar" );
   
  
  
  
  1.4       +26 -0     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractPlugin.java	20 Mar 2005 23:22:01 -0000	1.3
  +++ AbstractPlugin.java	21 Mar 2005 00:07:39 -0000	1.4
  @@ -16,11 +16,20 @@
    * limitations under the License.
    */
   
  +import org.apache.maven.monitor.logging.Log;
  +import org.apache.maven.monitor.logging.SystemStreamLog;
  +
  +/**
  + * @version $Id$
  + */
   public abstract class AbstractPlugin
       implements Plugin
   {
  +    private Log log;
  +
       /**
        * Default behaviour to mimic old behaviour.
  +     * @deprecated
        */
       public void execute( PluginExecutionRequest request )
           throws PluginExecutionException
  @@ -48,4 +57,21 @@
       public abstract void execute( PluginExecutionRequest request, PluginExecutionResponse
response )
           throws Exception;
   
  +    public void setLog( Log log )
  +    {
  +        this.log = log;
  +    }
  +
  +    public Log getLog()
  +    {
  +        synchronized(this)
  +        {
  +            if(log == null)
  +            {
  +                log = new SystemStreamLog();
  +            }
  +        }
  +
  +        return log;
  +    }
   }
  
  
  
  1.5       +6 -2      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Plugin.java	20 Mar 2005 23:22:01 -0000	1.4
  +++ Plugin.java	21 Mar 2005 00:07:39 -0000	1.5
  @@ -16,6 +16,8 @@
    * limitations under the License.
    */
   
  +import org.apache.maven.monitor.logging.Log;
  +
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
  @@ -24,7 +26,9 @@
   {
       String ROLE = Plugin.class.getName();
   
  -    // TODO: make this throw PluginExecutionException instead of generic exception
       void execute( PluginExecutionRequest request )
           throws PluginExecutionException;
  +
  +    // TODO: not sure about this here, and may want a getLog on here as well/instead
  +    void setLog( Log log );
   }
  
  
  
  1.3       +2 -24     maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java
  
  Index: PluginExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PluginExecutionRequest.java	4 Mar 2005 09:04:23 -0000	1.2
  +++ PluginExecutionRequest.java	21 Mar 2005 00:07:39 -0000	1.3
  @@ -16,13 +16,11 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.monitor.logging.Log;
  -import org.apache.maven.monitor.logging.SystemStreamLog;
  -
   import java.util.HashMap;
   import java.util.Map;
   
   /**
  + * @deprecated
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
    */
  @@ -32,8 +30,6 @@
   
       private Map context;
   
  -    private Log log;
  -
       public PluginExecutionRequest( Map parameters )
       {
           context = new HashMap();
  @@ -65,22 +61,4 @@
       {
           return context.get( key );
       }
  -
  -    public void setLog( Log log )
  -    {
  -        this.log = log;
  -    }
  -    
  -    public Log getLog()
  -    {
  -        synchronized(this)
  -        {
  -            if(log == null)
  -            {
  -                log = new SystemStreamLog();
  -            }
  -        }
  -        
  -        return log;
  -    }
   }
  
  
  
  1.3       +10 -1     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPlugin.java	20 Mar 2005 23:22:01 -0000	1.2
  +++ TestPlugin.java	21 Mar 2005 00:07:39 -0000	1.3
  @@ -16,6 +16,8 @@
    * limitations under the License.
    */
   
  +import org.apache.maven.monitor.logging.Log;
  +
   /**
    *
    * 
  @@ -34,6 +36,8 @@
   
       protected String foo;
   
  +    private Log log;
  +
       public boolean hasExecuted()
       {
           return executed;
  @@ -65,4 +69,9 @@
   
           executed = true;
       }
  +
  +    public void setLog( Log log )
  +    {
  +        this.log = log;
  +    }
   }
  
  
  

Mime
View raw message