Index: project.properties
===================================================================
RCS file: /home/cvspublic/maven/project.properties,v
retrieving revision 1.51.2.14
diff -u -r1.51.2.14 project.properties
--- project.properties	17 Feb 2004 22:00:43 -0000	1.51.2.14
+++ project.properties	21 Feb 2004 22:06:55 -0000
@@ -6,7 +6,8 @@
 maven.announcement = beta10
 maven.build.dir = ${basedir}/target
 maven.gen.docs = ${maven.build.dir}/generated-xdocs
-
+maven.ant.listener = org.apache.maven.jelly.JellyContextListener
+maven.ant.logger.level = 3
 
 maven.jar.manifest = manifest.mf
 
Index: src/java/org/apache/maven/AntProjectBuilder.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/AntProjectBuilder.java,v
retrieving revision 1.6.4.2
diff -u -r1.6.4.2 AntProjectBuilder.java
--- src/java/org/apache/maven/AntProjectBuilder.java	8 Jan 2004 07:05:57 -0000	1.6.4.2
+++ src/java/org/apache/maven/AntProjectBuilder.java	21 Feb 2004 22:06:56 -0000
@@ -56,12 +56,19 @@
  * ====================================================================
  */
 
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.commons.grant.GrantProject;
 import org.apache.commons.jelly.tags.ant.AntTagLibrary;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.maven.jelly.JellyBuildListener;
 import org.apache.maven.jelly.JellyPropsHandler;
 import org.apache.maven.jelly.MavenJellyContext;
 import org.apache.maven.project.Project;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.BuildLogger;
 import org.apache.tools.ant.types.Path;
 
 /**
@@ -69,6 +76,7 @@
  */
 public class AntProjectBuilder
 {
+  
     /**
      * Initialize Ant.
      * @param project a Maven project
@@ -76,18 +84,43 @@
      * @return an Ant project
      */
     public static GrantProject build( final Project project, final MavenJellyContext context )
-    {
-        // Create the build listener.
-        JellyBuildListener buildListener = new JellyBuildListener( context.getXMLOutput() );
-        buildListener.setDebug( context.getDebugOn().booleanValue() );
-        buildListener.setEmacsMode( context.getEmacsModeOn().booleanValue() );
-
+    {                
         // Create our ant project.
         GrantProject antProject = new GrantProject();
         antProject.setPropsHandler( new JellyPropsHandler( context ) );
         antProject.init();
         antProject.setBaseDir( project.getFile().getParentFile() );
-        antProject.addBuildListener( buildListener );
+        
+        // Create the build listeners.
+        BuildListenerFactory buildListenerFactory = new BuildListenerFactory( context );
+      	Object buildListeners = context.getVariable( MavenConstants.BUILD_LISTENER );
+      	if ( buildListeners instanceof List )
+      	{
+            for ( Iterator i = ( (List) buildListeners ).iterator() ; i.hasNext() ; )
+            {
+              	BuildListener buildListener = buildListenerFactory.createBuildListener ( (String) i.next() );
+            	  if (buildListener != null)
+            		{
+            	      antProject.addBuildListener( buildListener );
+            		}
+          	}
+      	}
+      	else
+      	{
+      	if ( buildListeners != null )
+      	  {
+      	      BuildListener buildListener = buildListenerFactory.createBuildListener ( (String) buildListeners );
+          	  if (buildListener != null)
+          	  {
+          	  			antProject.addBuildListener( buildListener );
+          	  }
+      		}
+      	}
+        
+        if (antProject.getBuildListeners() == null)
+        {
+          antProject.addBuildListener( buildListenerFactory.getDefaultListener() );
+        }
 
         context.setAntProject( antProject );
         AntTagLibrary.setProject( context, antProject );
@@ -98,5 +131,101 @@
 
         return antProject;
     }
-}
+    
+    /**
+     * Helper class to construct build listeners
+     */
+    private static class BuildListenerFactory 
+    {
+    		/** The logger */
+      	private static final Log log = LogFactory.getLog(BuildListenerFactory.class);
 
+        private MavenJellyContext context;
+            
+        /**
+         * Default constructor
+         */
+        public BuildListenerFactory( MavenJellyContext context )
+        {
+            this.context = context;
+        }
+    
+        /**
+         * Creates a build listener using the current <code>MavenJellyContext</code>
+         * 
+         * @param context
+         * @return
+         */
+        public BuildListener createBuildListener( String className ) 
+        {
+            BuildListener buildListener = null;
+            try
+            {
+                Class buildListenerClass = Class.forName( className );
+                buildListener = (BuildListener) buildListenerClass.newInstance();
+            }
+            catch ( ClassNotFoundException e )
+            {
+                log.warn("Unable to find " + className, e);
+            }
+            catch ( IllegalAccessException e ) 
+            {
+                log.warn("Unable to access " + className, e);
+            }
+            catch ( InstantiationException e)
+            {
+                log.warn("Unable to instantiate " + className, e);
+            }
+            if (buildListener == null) 
+            {
+                return null;
+            }
+            else if ( buildListener instanceof JellyBuildListener )
+            {
+                JellyBuildListener jellyBuildListener = (JellyBuildListener) buildListener;
+                jellyBuildListener.setXMLOutput( context.getXMLOutput() );
+                jellyBuildListener.setDebug( context.getDebugOn().booleanValue() );
+                jellyBuildListener.setEmacsMode( context.getEmacsModeOn().booleanValue() );
+                return jellyBuildListener;
+            } 
+            else if ( buildListener instanceof BuildLogger )
+            {
+              	BuildLogger buildLogger = (BuildLogger) buildListener;
+              	buildLogger.setErrorPrintStream( System.err );
+              	buildLogger.setOutputPrintStream( System.out );
+              	buildLogger.setEmacsMode( context.getEmacsModeOn().booleanValue() );
+              	Integer loggingLevel = null;
+              	try
+								{
+              		loggingLevel = new Integer( (String) context.getVariable( MavenConstants.BUILD_MSG_LEVEL ) );
+              	}
+              	catch (NumberFormatException e)
+								{
+              		log.warn("Invalid logging level set.  Using default value.");
+              		loggingLevel = new Integer(3);
+              	}
+              	buildLogger.setMessageOutputLevel(loggingLevel.intValue());
+              	return buildLogger;
+            }
+            else
+            {
+                return buildListener;
+            }
+        }
+      
+        /**
+         * Create a <code>JellyBuildListener</code>
+         * 
+         * @return a JellyBuildListener
+         */
+        public JellyBuildListener getDefaultListener( )
+        {
+            JellyBuildListener jellyBuildListener = new JellyBuildListener( context.getXMLOutput() );
+            jellyBuildListener.setDebug( context.getDebugOn().booleanValue() );
+            jellyBuildListener.setEmacsMode( context.getEmacsModeOn().booleanValue() );
+            return jellyBuildListener;
+        }
+    
+    }
+    
+}
\ No newline at end of file
Index: src/java/org/apache/maven/MavenConstants.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/MavenConstants.java,v
retrieving revision 1.30.4.3
diff -u -r1.30.4.3 MavenConstants.java
--- src/java/org/apache/maven/MavenConstants.java	6 Jan 2004 08:07:03 -0000	1.30.4.3
+++ src/java/org/apache/maven/MavenConstants.java	21 Feb 2004 22:06:56 -0000
@@ -157,6 +157,12 @@
 
     /** Plugin Manager tag. */
     public static final String PLUGIN_MANAGER = "maven.plugin.manager";
+    
+    /** Build listeners tag. */
+    public static final String BUILD_LISTENER = "maven.ant.listener";
+
+    /** Build listeners tag. */
+    public static final String BUILD_MSG_LEVEL = "maven.ant.logger.level";
 
     /** Jelly XMLOutput tag. */
     public static final String XML_OUTPUT = "maven.xmlOutput";
Index: src/java/org/apache/maven/jelly/JellyBuildListener.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/jelly/JellyBuildListener.java,v
retrieving revision 1.4.4.2
diff -u -r1.4.4.2 JellyBuildListener.java
--- src/java/org/apache/maven/jelly/JellyBuildListener.java	26 Jan 2004 23:36:08 -0000	1.4.4.2
+++ src/java/org/apache/maven/jelly/JellyBuildListener.java	21 Feb 2004 22:06:56 -0000
@@ -65,14 +65,38 @@
 
     /** Whether or not to use emacs-style output */
     protected boolean emacsMode = false;
+    
+    /**
+     * Default constuctor
+     */
+    public JellyBuildListener ( )
+    {
+      this.taskStack = new Stack();
+      this.debug = false;
+    }
 
+    /**
+     * Convenience constuctor
+     * 
+     * @param out
+     */
     public JellyBuildListener( XMLOutput out )
     {
         this.taskStack = new Stack();
         this.out = out;
         this.debug = false;
     }
-
+    
+    /**
+     * Set the <code>XMLOutput</code> for this listener
+     * 
+     * @param out
+     */
+    public void setXMLOutput ( XMLOutput out )
+    {
+        this.out = out;
+    }
+    
     /**
      * Sets this logger to produce emacs (and other editor) friendly output.
      *
Index: xdocs/reference/user-guide.xml
===================================================================
RCS file: /home/cvspublic/maven/xdocs/reference/user-guide.xml,v
retrieving revision 1.63.4.3
diff -u -r1.63.4.3 user-guide.xml
--- xdocs/reference/user-guide.xml	16 Feb 2004 22:58:13 -0000	1.63.4.3
+++ xdocs/reference/user-guide.xml	21 Feb 2004 22:06:58 -0000
@@ -643,6 +643,21 @@
               </td>
               <td>${maven.build.dir}/docs</td>
             </tr>
+	
+            <tr>
+              <td>maven.ant.listener</td>
+              <td>
+		Define an Ant listener.  Reference the <a href="http://ant.apache.org/manual/listeners.html">Ant Manual</a> for more information.
+              </td>
+              <td>org.apache.maven.jelly.JellyBuildListener</td>
+            </tr>
+
+            <tr>
+              <td>maven.ant.logger.level</td>
+              <td>
+                Define the logging level for Ant Loggers to use.   Reference the <a href="http://ant.apache.org/manual/listeners.html">Ant Manual</a> for more information.
+              </td>
+            </tr>
 
             <tr>
               <td>maven.docs.omitXmlDeclaration</td>
