You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/08 08:36:24 UTC

svn commit: r307267 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java pom.xml

Author: brett
Date: Fri Oct  7 23:36:17 2005
New Revision: 307267

URL: http://svn.apache.org/viewcvs?rev=307267&view=rev
Log:
PR: MNG-828
log parameters to mojo in debug mode

Added:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java   (with props)
Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/pom.xml

Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java?rev=307267&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java Fri Oct  7 23:36:17 2005
@@ -0,0 +1,53 @@
+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.codehaus.plexus.component.configurator.ConfigurationListener;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Log at debug level the mojo configuration.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class DebugConfigurationListener
+    implements ConfigurationListener
+{
+    private Logger logger;
+
+    public DebugConfigurationListener( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (s) " + fieldName + " = " + value );
+        }
+    }
+
+    public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
+    {
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (f) " + fieldName + " = " + value );
+        }
+    }
+}

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=307267&r1=307266&r2=307267&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri Oct  7 23:36:17 2005
@@ -58,6 +58,7 @@
 import org.codehaus.plexus.PlexusContainerException;
 import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
 import org.codehaus.plexus.component.configurator.ComponentConfigurator;
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
 import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
@@ -1036,8 +1037,12 @@
                 configurator = (ComponentConfigurator) pluginContainer.lookup( ComponentConfigurator.ROLE );
             }
 
+            ConfigurationListener listener = new DebugConfigurationListener( getLogger() );
+
+            getLogger().debug( "Configuring mojo '" + mojoDescriptor.getId() + "' -->" );
             configurator.configureComponent( plugin, configuration, expressionEvaluator,
-                                             pluginContainer.getContainerRealm() );
+                                             pluginContainer.getContainerRealm(), listener );
+            getLogger().debug( "-- end configuration --" );
         }
         catch ( ComponentConfigurationException e )
         {

Modified: maven/components/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/pom.xml?rev=307267&r1=307266&r2=307267&view=diff
==============================================================================
--- maven/components/trunk/pom.xml (original)
+++ maven/components/trunk/pom.xml Fri Oct  7 23:36:17 2005
@@ -203,7 +203,7 @@
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-container-default</artifactId>
-        <version>1.0-alpha-7</version>
+        <version>1.0-alpha-8-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>plexus</groupId>