You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/05/06 02:32:10 UTC

svn commit: r168481 - /maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin /maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy /maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin

Author: jdcasey
Date: Thu May  5 17:32:08 2005
New Revision: 168481

URL: http://svn.apache.org/viewcvs?rev=168481&view=rev
Log:
Final pass on cleaning up the mojo api...collapsed MavenPluginDescriptor and PluginDescriptor in the same way as MavenMojoDescriptor/MojoDescriptor had been; eliminated the need for plugin.descriptor.Dependency and MavenPluginDependency (using ComponentDependencies instead); adjusted the MojoExtractors (name?) to return Lists instead of Sets; added duplicate checking to a new addMojo(MojoDescriptor) method on PluginDescriptor, so we catch it on all sides; changed the Generators to use execute(outputDirectory, pluginDescriptor) rather than the myriad pluginDescriptor-derived values; added an IT for checking that the build for a plugin will fail if multiple mojos are detected with the same goal; and, added a special case to PluginDescriptor.getGoalPrefixFromArtifactId() to handle maven-plugin-plugin. That should be about it. I'm not sure that I've gotten the IT for that failure test added to svn yet, so that may follow.

Added:
    maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java   (with props)
    maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java   (with props)
Removed:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDependency.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDescriptor.java
    maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Dependency.java
Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java
    maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
    maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/MojoDescriptorExtractor.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/BeanGenerator.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/Generator.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly/JellyHarnessGenerator.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/MojoScanner.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/TestExtractor.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractorTest.java
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java
    maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
    maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java
    maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
    maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java

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=168481&r1=168480&r2=168481&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 Thu May  5 17:32:08 2005
@@ -119,10 +119,9 @@
 
     private Set pluginsInProcess = new HashSet();
 
-    public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor )
+    public void processPluginDescriptor( PluginDescriptor pluginDescriptor )
         throws CycleDetectedException
     {
-        PluginDescriptor pluginDescriptor = mavenPluginDescriptor.getPluginDescriptor();
         String key = pluginDescriptor.getId();
 
         if ( pluginsInProcess.contains( key ) )
@@ -132,7 +131,7 @@
 
         pluginsInProcess.add( key );
 
-        for ( Iterator it = mavenPluginDescriptor.getMavenMojoDescriptors().iterator(); it.hasNext(); )
+        for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
         {
             MojoDescriptor mojoDescriptor = (MojoDescriptor) it.next();
 
@@ -150,12 +149,12 @@
     {
         ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
 
-        if ( !( componentSetDescriptor instanceof MavenPluginDescriptor ) )
+        if ( !( componentSetDescriptor instanceof PluginDescriptor ) )
         {
             return;
         }
 
-        MavenPluginDescriptor pluginDescriptor = (MavenPluginDescriptor) componentSetDescriptor;
+        PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
 
         try
         {

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginDiscoverer.java Thu May  5 17:32:08 2005
@@ -17,18 +17,12 @@
  * ====================================================================
  */
 
-import org.apache.maven.plugin.descriptor.Dependency;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
 import org.codehaus.plexus.component.discovery.AbstractComponentDiscoverer;
 import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
 import org.codehaus.plexus.configuration.PlexusConfigurationException;
 
 import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -53,60 +47,6 @@
     public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorConfiguration, String source )
         throws PlexusConfigurationException
     {
-        PluginDescriptor pluginDescriptor;
-
-        try
-        {
-            pluginDescriptor = builder.build( componentDescriptorConfiguration );
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            // If the plugin is not valid, we cannot continue as it may make the lifecycle ebhave differently than expected
-            throw new PlexusConfigurationException( "Cannot process plugin descriptor: " + source, e );
-        }
-
-        // ----------------------------------------------------------------------
-        // We take the plugin descriptor as it has been built by the maven-plugin-descriptor
-        // code. This descriptor is specific to maven-plugin-descriptor and we are now
-        // going to adapt it into a ComponentSetDescriptor that can be
-        // utlized by Plexus.
-        // ----------------------------------------------------------------------
-
-        ComponentSetDescriptor componentSet = new MavenPluginDescriptor( pluginDescriptor );
-
-        // TODO: no group
-        componentSet.setId( pluginDescriptor.getArtifactId() );
-
-        // ----------------------------------------------------------------------
-        // If the ComponentSet states any dependencies then we want to collect
-        // them and store them for later use.
-        // ----------------------------------------------------------------------
-
-        if ( pluginDescriptor.getDependencies() != null )
-        {
-            List dependencies = new ArrayList();
-
-            for ( Iterator it = pluginDescriptor.getDependencies().iterator(); it.hasNext(); )
-            {
-                dependencies.add( new MavenPluginDependency( (Dependency) it.next() ) );
-            }
-
-            componentSet.setDependencies( dependencies );
-        }
-
-        // ----------------------------------------------------------------------
-        // Process each of the component descriptors within the ComponentSet.
-        // ----------------------------------------------------------------------
-
-        List componentDescriptors = new ArrayList();
-
-        for ( Iterator iterator = pluginDescriptor.getMojos().iterator(); iterator.hasNext(); )
-        {
-            componentDescriptors.add( (MojoDescriptor) iterator.next() );
-        }
-
-        componentSet.setComponents( componentDescriptors );
-
-        return componentSet;
+        return builder.build( componentDescriptorConfiguration );
     }
 }

Added: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java?rev=168481&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java (added)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java Thu May  5 17:32:08 2005
@@ -0,0 +1,28 @@
+package org.apache.maven.plugin.descriptor;
+
+/*
+ * 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.
+ */
+
+public class DuplicateMojoDescriptorException
+    extends PluginConfigurationException
+{
+
+    public DuplicateMojoDescriptorException( String goalPrefix, String goal, String existingImplementation, String newImplementation )
+    {
+        super( "Goal: " + goal + " already exists in the plugin descriptor for prefix: " + goalPrefix + "\nExisting implementation is: " + existingImplementation + "\nConflicting implementation is: " + newImplementation );
+    }
+
+}

Propchange: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Added: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java?rev=168481&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java (added)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java Thu May  5 17:32:08 2005
@@ -0,0 +1,35 @@
+package org.apache.maven.plugin.descriptor;
+
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+
+/*
+ * 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.
+ */
+
+public class PluginConfigurationException
+    extends PlexusConfigurationException
+{
+
+    public PluginConfigurationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public PluginConfigurationException( String message )
+    {
+        super( message );
+    }
+
+}

Propchange: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java Thu May  5 17:32:08 2005
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 
-import java.util.LinkedList;
+import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
+
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -24,9 +26,8 @@
  * @version $Id$
  */
 public class PluginDescriptor
+    extends ComponentSetDescriptor
 {
-    private List mojos;
-
     private String groupId;
 
     private String artifactId;
@@ -43,12 +44,41 @@
 
     public List getMojos()
     {
-        return mojos;
+        return getComponents();
     }
 
     public void setMojos( List mojos )
+        throws DuplicateMojoDescriptorException
     {
-        this.mojos = new LinkedList( mojos );
+        for ( Iterator it = mojos.iterator(); it.hasNext(); )
+        {
+            MojoDescriptor descriptor = (MojoDescriptor) it.next();
+
+            addMojo( descriptor );
+        }
+    }
+
+    public void addMojo( MojoDescriptor mojoDescriptor )
+        throws DuplicateMojoDescriptorException
+    {
+        // this relies heavily on the equals() and hashCode() for ComponentDescriptor, 
+        // which uses role:roleHint for identity...and roleHint == goalPrefix:goal.
+        // role does not vary for Mojos.
+        List mojos = getComponents();
+
+        if ( mojos != null && mojos.contains( mojoDescriptor ) )
+        {
+            int indexOf = mojos.indexOf( mojoDescriptor );
+
+            MojoDescriptor existing = (MojoDescriptor) mojos.get( indexOf );
+
+            throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing
+                .getImplementation(), mojoDescriptor.getImplementation() );
+        }
+        else
+        {
+            addComponentDescriptor( mojoDescriptor );
+        }
     }
 
     public String getGroupId()
@@ -69,22 +99,14 @@
     public void setArtifactId( String artifactId )
     {
         this.artifactId = artifactId;
+
+        setId( artifactId );
     }
 
     // ----------------------------------------------------------------------
     // Dependencies
     // ----------------------------------------------------------------------
 
-    public List getDependencies()
-    {
-        return dependencies;
-    }
-
-    public void setDependencies( List dependencies )
-    {
-        this.dependencies = new LinkedList( dependencies );
-    }
-
     public boolean isIsolatedRealm()
     {
         return isolatedRealm;
@@ -137,7 +159,14 @@
      */
     public static String getGoalPrefixFromArtifactId( String artifactId )
     {
-        return artifactId.replaceAll( "-?maven-?", "" ).replaceAll( "-?plugin-?", "" );
+        if ( "maven-plugin-plugin".equals( artifactId ) )
+        {
+            return "plugin";
+        }
+        else
+        {
+            return artifactId.replaceAll( "-?maven-?", "" ).replaceAll( "-?plugin-?", "" );
+        }
     }
 
     /**

Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java Thu May  5 17:32:08 2005
@@ -1,5 +1,6 @@
 package org.apache.maven.plugin.descriptor;
 
+import org.codehaus.plexus.component.repository.ComponentDependency;
 import org.codehaus.plexus.component.repository.ComponentRequirement;
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 import org.codehaus.plexus.configuration.PlexusConfigurationException;
@@ -35,17 +36,15 @@
 
         PlexusConfiguration[] mojoConfigurations = c.getChild( "mojos" ).getChildren( "mojo" );
 
-        List mojos = new ArrayList();
-
         for ( int i = 0; i < mojoConfigurations.length; i++ )
         {
             PlexusConfiguration component = mojoConfigurations[i];
 
-            mojos.add( buildComponentDescriptor( component, pluginDescriptor ) );
+            MojoDescriptor mojoDescriptor = buildComponentDescriptor( component, pluginDescriptor );
+            
+            pluginDescriptor.addMojo( mojoDescriptor );
         }
 
-        pluginDescriptor.setMojos( mojos );
-
         // ----------------------------------------------------------------------
         // Dependencies
         // ----------------------------------------------------------------------
@@ -58,7 +57,7 @@
         {
             PlexusConfiguration d = dependencyConfigurations[i];
 
-            Dependency cd = new Dependency();
+            ComponentDependency cd = new ComponentDependency();
 
             cd.setArtifactId( d.getChild( "artifactId" ).getValue() );
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/AbstractScriptedMojoDescriptorExtractor.java Thu May  5 17:32:08 2005
@@ -21,18 +21,18 @@
     extends AbstractLogEnabled
     implements MojoDescriptorExtractor
 {
-    public Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    public List execute( MavenProject project, PluginDescriptor pluginDescriptor )
         throws PluginToolsException
     {
         Map scriptFilesKeyedByBasedir = gatherScriptSourcesByBasedir( project.getScriptSourceRoots(),
                                                                       getScriptFileExtension() );
 
-        Set mojoDescriptors = extractMojoDescriptors( scriptFilesKeyedByBasedir, pluginDescriptor );
+        List mojoDescriptors = extractMojoDescriptors( scriptFilesKeyedByBasedir, pluginDescriptor );
 
         return mojoDescriptors;
     }
 
-    protected abstract Set extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
+    protected abstract List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
         throws PluginToolsException;
 
     protected abstract String getScriptFileExtension();

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/MojoDescriptorExtractor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/MojoDescriptorExtractor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/MojoDescriptorExtractor.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/extractor/MojoDescriptorExtractor.java Thu May  5 17:32:08 2005
@@ -16,11 +16,11 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.PluginToolsException;
 
-import java.util.Set;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -29,6 +29,6 @@
 {
     String ROLE = MojoDescriptorExtractor.class.getName();
 
-    Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    List execute( MavenProject project, PluginDescriptor pluginDescriptor )
         throws PluginToolsException;
 }

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/BeanGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/BeanGenerator.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/BeanGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/BeanGenerator.java Thu May  5 17:32:08 2005
@@ -18,7 +18,7 @@
 
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.codehaus.modello.generator.java.javasource.JClass;
 import org.codehaus.modello.generator.java.javasource.JConstructor;
 import org.codehaus.modello.generator.java.javasource.JMethod;
@@ -32,7 +32,6 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 /**
  * [JC] Is this class defunct now? I can't find o.a.m.plugin.BeanPluginAdapter in the codebase...
@@ -44,10 +43,10 @@
 public class BeanGenerator
     implements Generator
 {
-    public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project, String goalPrefix )
+    public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
         throws IOException
     {
-        for ( Iterator it = mojoDescriptors.iterator(); it.hasNext(); )
+        for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
         {
             MojoDescriptor descriptor = (MojoDescriptor) it.next();
             processPluginDescriptor( descriptor, destinationDirectory );

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/Generator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/Generator.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/Generator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/Generator.java Thu May  5 17:32:08 2005
@@ -16,9 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 
-import java.util.Set;
 import java.io.IOException;
 
 /**
@@ -27,6 +26,6 @@
  */
 public interface Generator
 {
-    void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project, String goalPrefix )
+    void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
         throws IOException;
 }

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java Thu May  5 17:32:08 2005
@@ -19,7 +19,6 @@
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.util.PluginUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
@@ -35,7 +34,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * @todo add example usage tag that can be shown in the doco
@@ -45,8 +43,7 @@
 public class PluginDescriptorGenerator
     implements Generator
 {
-    public void execute( String destinationDirectory, Set mavenMojoDescriptors, MavenProject project,
-                         String goalPrefix )
+    public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
         throws IOException
     {
         File f = new File( destinationDirectory, "plugin.xml" );
@@ -65,23 +62,23 @@
 
             w.startElement( "plugin" );
 
-            element( w, "groupId", project.getGroupId() );
+            element( w, "groupId", pluginDescriptor.getGroupId() );
 
-            element( w, "artifactId", project.getArtifactId() );
+            element( w, "artifactId", pluginDescriptor.getArtifactId() );
 
-            element( w, "goalPrefix", goalPrefix );
+            element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
 
              w.startElement( "mojos" );
 
-            for ( Iterator it = mavenMojoDescriptors.iterator(); it.hasNext(); )
+            for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
             {
                 MojoDescriptor descriptor = (MojoDescriptor) it.next();
-                processPluginDescriptor( descriptor, w, project );
+                processMojoDescriptor( descriptor, w );
             }
 
             w.endElement();
 
-            PluginUtils.writeDependencies( w, project );
+            PluginUtils.writeDependencies( w, pluginDescriptor );
 
             w.endElement();
 
@@ -93,7 +90,7 @@
         }
     }
 
-    protected void processPluginDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w, MavenProject project )
+    protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w )
     {
         w.startElement( "mojo" );
 
@@ -221,56 +218,61 @@
         w.startElement( "parameters" );
 
         Collection requirements = new ArrayList();
-        Map configuration = new HashMap( parameters.size() );
-        for ( int j = 0; j < parameters.size(); j++ )
+        
+        Map configuration = new HashMap();
+        
+        if( parameters != null )
         {
-            Parameter parameter = (Parameter) parameters.get( j );
+            for ( int j = 0; j < parameters.size(); j++ )
+            {
+                Parameter parameter = (Parameter) parameters.get( j );
 
-            String expression = parameter.getExpression();
+                String expression = parameter.getExpression();
 
-            if ( StringUtils.isNotEmpty( expression ) && expression.startsWith( "${component." ) )
-            {
-                // treat it as a component...a requirement, in other words.
+                if ( StringUtils.isNotEmpty( expression ) && expression.startsWith( "${component." ) )
+                {
+                    // treat it as a component...a requirement, in other words.
 
-                requirements.add( parameter );
-            }
-            else
-            {
-                // treat it as a normal parameter.
+                    requirements.add( parameter );
+                }
+                else
+                {
+                    // treat it as a normal parameter.
 
-                w.startElement( "parameter" );
+                    w.startElement( "parameter" );
 
-                element( w, "name", parameter.getName() );
+                    element( w, "name", parameter.getName() );
 
-                if ( parameter.getAlias() != null )
-                {
-                    element( w, "alias", parameter.getAlias() );
-                }
+                    if ( parameter.getAlias() != null )
+                    {
+                        element( w, "alias", parameter.getAlias() );
+                    }
 
-                element( w, "type", parameter.getType() );
+                    element( w, "type", parameter.getType() );
 
-                if ( parameter.getDeprecated() != null )
-                {
-                    element( w, "deprecated", parameter.getDeprecated() );
-                }
+                    if ( parameter.getDeprecated() != null )
+                    {
+                        element( w, "deprecated", parameter.getDeprecated() );
+                    }
 
-                // TODO: do we still need this?
-                element( w, "validator", parameter.getValidator() );
+                    // TODO: do we still need this?
+                    element( w, "validator", parameter.getValidator() );
 
-                element( w, "required", Boolean.toString( parameter.isRequired() ) );
+                    element( w, "required", Boolean.toString( parameter.isRequired() ) );
 
-                element( w, "editable", Boolean.toString( parameter.isEditable() ) );
+                    element( w, "editable", Boolean.toString( parameter.isEditable() ) );
 
-                element( w, "description", parameter.getDescription() );
+                    element( w, "description", parameter.getDescription() );
 
-                if ( expression != null && expression.length() > 0 )
-                {
-                    configuration.put( parameter, expression );
+                    if ( expression != null && expression.length() > 0 )
+                    {
+                        configuration.put( parameter, expression );
+                    }
+
+                    w.endElement();
                 }
 
-                w.endElement();
             }
-
         }
 
         w.endElement();

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java Thu May  5 17:32:08 2005
@@ -18,9 +18,9 @@
 
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.StringUtils;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
@@ -30,7 +30,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * @todo add example usage tag that can be shown in the doco
@@ -40,10 +39,10 @@
 public class PluginXdocGenerator
     implements Generator
 {
-    public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project, String goalPrefix )
+    public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
         throws IOException
     {
-        for ( Iterator it = mojoDescriptors.iterator(); it.hasNext(); )
+        for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
         {
             MojoDescriptor descriptor = (MojoDescriptor) it.next();
             processPluginDescriptor( descriptor, destinationDirectory );

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly/JellyHarnessGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly/JellyHarnessGenerator.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly/JellyHarnessGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/jelly/JellyHarnessGenerator.java Thu May  5 17:32:08 2005
@@ -18,6 +18,7 @@
 
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.generator.Generator;
 import org.apache.maven.tools.plugin.util.PluginUtils;
@@ -49,7 +50,7 @@
         return pluginDescriptor.getImplementation() + "Bean";
     }
 
-    public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project, String goalPrefix )
+    public void execute( String destinationDirectory, PluginDescriptor pluginDescriptor )
         throws IOException
     {
         FileWriter writer = null;
@@ -60,7 +61,7 @@
 
             w = new PrettyPrintXMLWriter( writer );
 
-            writePluginFile( w, goalPrefix, mojoDescriptors, project );
+            writeProjectFile( w, pluginDescriptor );
 
             writer.flush();
         }
@@ -80,7 +81,7 @@
 
             w = new PrettyPrintXMLWriter( writer );
 
-            writeProjectFile( w, project );
+            writeProjectFile( w, pluginDescriptor );
 
             writer.flush();
         }
@@ -133,13 +134,13 @@
         w.endElement();
     }
 
-    private void writeProjectFile( PrettyPrintXMLWriter w, MavenProject project )
+    private void writeProjectFile( PrettyPrintXMLWriter w, PluginDescriptor pluginDescriptor )
     {
         w.startElement( "project" );
 
         w.startElement( "dependencies" );
 
-        PluginUtils.writeDependencies( w, project );
+        PluginUtils.writeDependencies( w, pluginDescriptor );
 
         w.endElement();
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java Thu May  5 17:32:08 2005
@@ -16,21 +16,25 @@
  * limitations under the License.
  */
 
+import org.apache.maven.plugin.descriptor.DuplicateMojoDescriptorException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
-import org.apache.maven.tools.plugin.extractor.InvalidParameterException;
 import org.apache.maven.tools.plugin.PluginToolsException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.console.ConsoleLogger;
 
-import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * @author jdcasey
  */
 public class DefaultMojoScanner
+    extends AbstractLogEnabled
     implements MojoScanner
 {
 
@@ -39,18 +43,20 @@
     public DefaultMojoScanner( Map extractors )
     {
         this.mojoDescriptorExtractors = extractors;
+
+        this.enableLogging( new ConsoleLogger( Logger.LEVEL_INFO, "standalone-scanner-logger" ) );
     }
 
     public DefaultMojoScanner()
     {
     }
 
-    public Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    public void populatePluginDescriptor( MavenProject project, PluginDescriptor pluginDescriptor )
         throws PluginToolsException
     {
-        Set descriptors = new HashSet();
+        Logger logger = getLogger();
 
-        System.out.println( "Using " + mojoDescriptorExtractors.size() + " extractors." );
+        logger.debug( "Using " + mojoDescriptorExtractors.size() + " extractors." );
 
         for ( Iterator it = mojoDescriptorExtractors.entrySet().iterator(); it.hasNext(); )
         {
@@ -58,17 +64,32 @@
             String language = (String) entry.getKey();
             MojoDescriptorExtractor extractor = (MojoDescriptorExtractor) entry.getValue();
 
-            System.out.println( "Applying extractor for language: " + language );
+            logger.debug( "Applying extractor for language: " + language );
 
-            Set extractorDescriptors = extractor.execute( project, pluginDescriptor );
+            List extractorDescriptors = extractor.execute( project, pluginDescriptor );
 
-            System.out.println( "Extractor for language: " + language + " found " + extractorDescriptors.size() +
-                                " mojo descriptors." );
+            logger.debug( "Extractor for language: " + language + " found " + extractorDescriptors.size()
+                + " mojo descriptors." );
 
-            descriptors.addAll( extractorDescriptors );
+            for ( Iterator descriptorIt = extractorDescriptors.iterator(); descriptorIt.hasNext(); )
+            {
+                MojoDescriptor descriptor = (MojoDescriptor) descriptorIt.next();
+
+                logger.debug( "Adding mojo: " + descriptor + " to plugin descriptor." );
+
+                descriptor.setPluginDescriptor( pluginDescriptor );
+
+                try
+                {
+                    pluginDescriptor.addMojo( descriptor );
+                }
+                catch ( DuplicateMojoDescriptorException e )
+                {
+                    throw new PluginToolsException( "Duplicate goal specification detected.\nError was: "
+                        + e.getLocalizedMessage(), e );
+                }
+            }
         }
-
-        return descriptors;
     }
 
 }

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/MojoScanner.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/MojoScanner.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/MojoScanner.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/MojoScanner.java Thu May  5 17:32:08 2005
@@ -16,13 +16,10 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.tools.plugin.extractor.InvalidParameterException;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.PluginToolsException;
 
-import java.util.Set;
-
 /**
  * @author jdcasey
  */
@@ -30,7 +27,7 @@
 {
     String ROLE = MojoScanner.class.getName();
 
-    Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    void populatePluginDescriptor( MavenProject project, PluginDescriptor pluginDescriptor )
         throws PluginToolsException;
 
 }

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java Thu May  5 17:32:08 2005
@@ -16,14 +16,16 @@
  * limitations under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Dependency;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.component.repository.ComponentDependency;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -60,32 +62,50 @@
         return scanner.getIncludedFiles();
     }
 
-    public static void writeDependencies( XMLWriter w, MavenProject project )
+    public static void writeDependencies( XMLWriter w, PluginDescriptor pluginDescriptor )
     {
 
         w.startElement( "dependencies" );
 
-        for ( Iterator it = project.getDependencies().iterator(); it.hasNext(); )
+        for ( Iterator it = pluginDescriptor.getDependencies().iterator(); it.hasNext(); )
         {
-            Dependency dep = (Dependency) it.next();
+            ComponentDependency dep = (ComponentDependency) it.next();
             
-            if ( !Artifact.SCOPE_TEST.equals( dep.getScope() ) )
-            {
-                w.startElement( "dependency" );
+            w.startElement( "dependency" );
 
-                PluginUtils.element( w, "groupId", dep.getGroupId() );
+            PluginUtils.element( w, "groupId", dep.getGroupId() );
 
-                PluginUtils.element( w, "artifactId", dep.getArtifactId() );
+            PluginUtils.element( w, "artifactId", dep.getArtifactId() );
 
-                PluginUtils.element( w, "type", dep.getType() );
+            PluginUtils.element( w, "type", dep.getType() );
 
-                PluginUtils.element( w, "version", dep.getVersion() );
+            PluginUtils.element( w, "version", dep.getVersion() );
 
-                w.endElement();
-            }
+            w.endElement();
         }
 
         w.endElement();
+    }
+    
+    public static List toComponentDependencies(List dependencies)
+    {
+        List componentDeps = new LinkedList();
+
+        for ( Iterator it = dependencies.iterator(); it.hasNext(); )
+        {
+            Dependency dependency = (Dependency) it.next();
+            
+            ComponentDependency cd = new ComponentDependency();
+
+            cd.setArtifactId( dependency.getArtifactId() );
+            cd.setGroupId( dependency.getGroupId() );
+            cd.setVersion( dependency.getVersion() );
+            cd.setType( dependency.getType() );
+
+            componentDeps.add( cd );
+        }
+        
+        return componentDeps;
     }
 
     private static void element( XMLWriter w, String name, String value )

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java Thu May  5 17:32:08 2005
@@ -16,12 +16,10 @@
  * limitations under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.component.repository.ComponentDependency;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -29,6 +27,8 @@
 import java.util.List;
 import java.util.Set;
 
+import junit.framework.TestCase;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  * @version $Id: AbstractGeneratorTestCase.java,v 1.1 2005/02/20 16:25:21
@@ -52,8 +52,6 @@
     {
         setupGenerator();
 
-        String destinationDirectory = new File( basedir, "target" ).getPath();
-
         MojoDescriptor mojoDescriptor = new MojoDescriptor();
         mojoDescriptor.setGoal( "testGoal" );
         mojoDescriptor.setImplementation( "org.apache.maven.tools.plugin.generator.TestMojo" );
@@ -74,23 +72,27 @@
         mojoDescriptor.setParameters( params );
 
         Set descriptors = Collections.singleton( mojoDescriptor );
+        
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        
+        pluginDescriptor.addMojo(mojoDescriptor);
 
-        Model model = new Model();
+        pluginDescriptor.setArtifactId( "maven-unitTesting-plugin" );
+        pluginDescriptor.setGoalPrefix( "test" );
 
-        model.setArtifactId( "maven-unitTesting-plugin" );
-
-        Dependency dependency = new Dependency();
+        ComponentDependency dependency = new ComponentDependency();
         dependency.setGroupId( "testGroup" );
         dependency.setArtifactId( "testArtifact" );
         dependency.setVersion( "0.0.0" );
 
-        model.addDependency( dependency );
-
-        MavenProject project = new MavenProject( model );
-
-        generator.execute( destinationDirectory, descriptors, project, "test" );
+        pluginDescriptor.setDependencies( Collections.singletonList( dependency ) );
 
-        validate();
+        File tempFile = File.createTempFile( "testGenerator-outDir", ".marker.txt" ).getAbsoluteFile();
+        File destinationDirectory = tempFile.getParentFile();
+        
+        generator.execute( destinationDirectory.getAbsolutePath(), pluginDescriptor );
+        
+        validate(destinationDirectory);
     }
 
     // ----------------------------------------------------------------------
@@ -122,7 +124,7 @@
     //
     // ----------------------------------------------------------------------
 
-    protected void validate()
+    protected void validate(File destinationDirectory)
         throws Exception
     {
         // empty

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java Thu May  5 17:32:08 2005
@@ -16,11 +16,11 @@
  * limitations under the License.
  */
 
-import org.apache.maven.plugin.descriptor.Dependency;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
+import org.codehaus.plexus.component.repository.ComponentDependency;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -39,17 +39,19 @@
 public class PluginDescriptorGeneratorTest
     extends AbstractGeneratorTestCase
 {
-    protected void validate()
+    protected void validate(File destinationDirectory)
         throws Exception
     {
         PluginDescriptorBuilder pdb = new PluginDescriptorBuilder();
 
-        File pluginDescriptorFile = new File( basedir, "target/plugin.xml" );
+        File pluginDescriptorFile = new File( destinationDirectory, "plugin.xml" );
 
         String pd = readFile( pluginDescriptorFile );
 
         PluginDescriptor pluginDescriptor = pdb.build( new StringReader( pd ) );
 
+        assertEquals( 1, pluginDescriptor.getMojos().size() );
+        
         MojoDescriptor mojoDescriptor = (MojoDescriptor) pluginDescriptor.getMojos().get( 0 );
 
         checkMojo( mojoDescriptor );
@@ -60,11 +62,11 @@
 
         List dependencies = pluginDescriptor.getDependencies();
 
-        checkDependency( "testGroup", "testArtifact", "0.0.0", (Dependency) dependencies.get( 0 ) );
+        checkDependency( "testGroup", "testArtifact", "0.0.0", (ComponentDependency) dependencies.get( 0 ) );
 
         assertEquals( 1, dependencies.size() );
 
-        Dependency dependency = (Dependency) dependencies.get( 0 );
+        ComponentDependency dependency = (ComponentDependency) dependencies.get( 0 );
         assertEquals( "testGroup", dependency.getGroupId() );
         assertEquals( "testArtifact", dependency.getArtifactId() );
         assertEquals( "0.0.0", dependency.getVersion() );
@@ -111,7 +113,7 @@
         assertTrue( parameter.isRequired() );
     }
 
-    private void checkDependency( String groupId, String artifactId, String version, Dependency dependency )
+    private void checkDependency( String groupId, String artifactId, String version, ComponentDependency dependency )
     {
         assertNotNull( dependency );
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java Thu May  5 17:32:08 2005
@@ -1,6 +1,5 @@
 package org.apache.maven.tools.plugin.scanner;
 
-import junit.framework.TestCase;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -9,8 +8,10 @@
 
 import java.io.File;
 import java.util.Collections;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
+
+import junit.framework.TestCase;
 
 /**
  * @author jdcasey
@@ -37,8 +38,11 @@
 
         PluginDescriptor pluginDescriptor = new PluginDescriptor();
         pluginDescriptor.setGoalPrefix( "testId" );
-        Set descriptors = scanner.execute( project, pluginDescriptor );
+        
+        scanner.populatePluginDescriptor( project, pluginDescriptor );
 
+        List descriptors = pluginDescriptor.getMojos();
+        
         assertEquals( 1, descriptors.size() );
 
         MojoDescriptor desc = (MojoDescriptor) descriptors.iterator().next();

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/TestExtractor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/TestExtractor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/TestExtractor.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/TestExtractor.java Thu May  5 17:32:08 2005
@@ -6,7 +6,7 @@
 import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
 
 import java.util.Collections;
-import java.util.Set;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -15,13 +15,13 @@
     implements MojoDescriptorExtractor
 {
 
-    public Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    public List execute( MavenProject project, PluginDescriptor pluginDescriptor )
     {
         MojoDescriptor desc = new MojoDescriptor();
         desc.setPluginDescriptor( pluginDescriptor );
         desc.setGoal( "testGoal" );
-
-        return Collections.singleton( desc );
+        
+        return Collections.singletonList( desc );
     }
 
 }

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java Thu May  5 17:32:08 2005
@@ -1,14 +1,14 @@
 package org.apache.maven.tools.plugin.util;
 
-import junit.framework.TestCase;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.repository.ComponentDependency;
 import org.codehaus.plexus.util.xml.CompactXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 import java.io.StringWriter;
+import java.util.Collections;
+
+import junit.framework.TestCase;
 
 /**
  * @author jdcasey
@@ -24,26 +24,25 @@
         assertEquals( "artifactId", PluginDescriptor.getGoalPrefixFromArtifactId( "artifactId-maven-plugin" ) );
         assertEquals( "artifactId", PluginDescriptor.getGoalPrefixFromArtifactId( "artifactId" ) );
         assertEquals( "artifactId", PluginDescriptor.getGoalPrefixFromArtifactId( "artifactId-plugin" ) );
+        assertEquals( "plugin", PluginDescriptor.getGoalPrefixFromArtifactId( "maven-plugin-plugin" ) );
     }
 
     public void testShouldWriteDependencies()
         throws Exception
     {
-        Dependency dependency = new Dependency();
+        ComponentDependency dependency = new ComponentDependency();
         dependency.setArtifactId( "testArtifactId" );
         dependency.setGroupId( "testGroupId" );
         dependency.setType( "pom" );
         dependency.setVersion( "0.0.0" );
-
-        Model model = new Model();
-        model.addDependency( dependency );
-
-        MavenProject project = new MavenProject( model );
+        
+        PluginDescriptor descriptor = new PluginDescriptor();
+        descriptor.setDependencies( Collections.singletonList( dependency ) );
 
         StringWriter sWriter = new StringWriter();
         XMLWriter writer = new CompactXMLWriter( sWriter );
 
-        PluginUtils.writeDependencies( writer, project );
+        PluginUtils.writeDependencies( writer, descriptor );
 
         String output = sWriter.toString();
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java Thu May  5 17:32:08 2005
@@ -16,30 +16,30 @@
  * limitations under the License.
  */
 
-import com.thoughtworks.qdox.JavaDocBuilder;
-import com.thoughtworks.qdox.model.DocletTag;
-import com.thoughtworks.qdox.model.JavaClass;
-import com.thoughtworks.qdox.model.JavaField;
-import com.thoughtworks.qdox.model.JavaSource;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.extractor.InvalidParameterException;
 import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
-import org.apache.maven.tools.plugin.PluginToolsException;
 import org.codehaus.modello.StringUtils;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
+import com.thoughtworks.qdox.JavaDocBuilder;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+import com.thoughtworks.qdox.model.JavaSource;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.Map.Entry;
 
 /**
  * @todo add example usage tag that can be shown in the doco
@@ -328,17 +328,13 @@
         return javaSource.getClasses()[0];
     }
 
-    public Set execute( MavenProject project, PluginDescriptor pluginDescriptor )
+    public List execute( MavenProject project, PluginDescriptor pluginDescriptor )
         throws InvalidParameterException
     {
         JavaDocBuilder builder = new JavaDocBuilder();
 
         File basedir = project.getBasedir();
 
-        System.out.println( "Project basedir: " + basedir );
-
-        System.out.println( "Source directory for java mojo extraction: " + project.getCompileSourceRoots() );
-
         for ( Iterator i = project.getCompileSourceRoots().iterator(); i.hasNext(); )
         {
             builder.addSourceTree( new File( (String) i.next() ) );
@@ -346,7 +342,7 @@
 
         JavaSource[] javaSources = builder.getSources();
 
-        Set descriptors = new HashSet();
+        List descriptors = new ArrayList();
 
         for ( int i = 0; i < javaSources.length; i++ )
         {
@@ -365,9 +361,12 @@
 
                 List parameters = mojoDescriptor.getParameters();
 
-                for ( int j = 0; j < parameters.size(); j++ )
+                if ( parameters != null )
                 {
-                    validateParameter( (Parameter) parameters.get( j ), j );
+                    for ( int j = 0; j < parameters.size(); j++ )
+                    {
+                        validateParameter( (Parameter) parameters.get( j ), j );
+                    }
                 }
 
                 //                Commented because it causes a VerifyError:

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java Thu May  5 17:32:08 2005
@@ -23,7 +23,7 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.Set;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -52,7 +52,7 @@
 
         PluginDescriptor pluginDescriptor = new PluginDescriptor();
         pluginDescriptor.setGoalPrefix( "test" );
-        Set results = extractor.execute( project, pluginDescriptor );
+        List results = extractor.execute( project, pluginDescriptor );
         assertEquals( 2, results.size() );
     }
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java Thu May  5 17:32:08 2005
@@ -20,25 +20,22 @@
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.script.marmalade.MarmaladeMojoExecutionDirectives;
 import org.apache.maven.script.marmalade.tags.MojoTag;
-import org.apache.maven.tools.plugin.extractor.AbstractScriptedMojoDescriptorExtractor;
 import org.apache.maven.tools.plugin.PluginToolsException;
-import org.codehaus.marmalade.launch.MarmaladeLauncher;
+import org.apache.maven.tools.plugin.extractor.AbstractScriptedMojoDescriptorExtractor;
 import org.codehaus.marmalade.launch.MarmaladeLaunchException;
+import org.codehaus.marmalade.launch.MarmaladeLauncher;
 import org.codehaus.marmalade.model.MarmaladeScript;
 import org.codehaus.marmalade.model.MarmaladeTag;
-import org.codehaus.marmalade.runtime.DefaultContext;
-import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
-import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
 import org.codehaus.plexus.component.factory.marmalade.PlexusIntegratedLog;
 import org.codehaus.plexus.logging.Logger;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.HashSet;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
 
 /**
  * @author jdcasey
@@ -52,7 +49,7 @@
         return ".mmld";
     }
 
-    protected Set extractMojoDescriptors( Map sourceFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
+    protected List extractMojoDescriptors( Map sourceFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
         throws PluginToolsException
     {
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
@@ -60,7 +57,7 @@
         {
             Thread.currentThread().setContextClassLoader( MarmaladeMojoDescriptorExtractor.class.getClassLoader() );
 
-            Set descriptors = new HashSet();
+            List descriptors = new ArrayList();
 
             for ( Iterator mapIterator = sourceFilesKeyedByBasedir.entrySet().iterator(); mapIterator.hasNext(); )
             {
@@ -73,60 +70,58 @@
                 {
                     File scriptFile = (File) it.next();
 
-                    MarmaladeLauncher launcher = new MarmaladeLauncher().withInputFile( scriptFile );
-
-                    Logger logger = getLogger();
-
-                    if ( logger != null )
+                    try
                     {
-                        PlexusIntegratedLog log = new PlexusIntegratedLog();
+                        MarmaladeLauncher launcher = new MarmaladeLauncher().withInputFile( scriptFile );
 
-                        log.enableLogging( logger );
+                        Logger logger = getLogger();
 
-                        launcher = launcher.withLog( log );
+                        if ( logger != null )
+                        {
+                            PlexusIntegratedLog log = new PlexusIntegratedLog();
+
+                            log.enableLogging( logger );
+
+                            launcher = launcher.withLog( log );
+                        }
+
+                        MarmaladeScript script = launcher.getMarmaladeScript();
+
+                        MarmaladeTag rootTag = script.getRoot();
+                        if ( rootTag instanceof MojoTag )
+                        {
+                            launcher.withVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR, basedir );
+                            launcher
+                                .withVariable( MarmaladeMojoExecutionDirectives.PLUGIN_DESCRIPTOR, pluginDescriptor );
+
+                            Map contextMap = launcher.run();
+
+                            MojoDescriptor descriptor = (MojoDescriptor) contextMap
+                                .get( MarmaladeMojoExecutionDirectives.METADATA_OUTVAR );
+
+                            descriptors.add( descriptor );
+                        }
+                        else
+                        {
+                            getLogger().debug(
+                                               "Found non-mojo marmalade script at: " + scriptFile
+                                                   + ".\nIts root tag is {element: "
+                                                   + rootTag.getTagInfo().getElement() + ", class: "
+                                                   + rootTag.getClass().getName() + "}" );
+                        }
                     }
-
-                    MarmaladeScript script = launcher.getMarmaladeScript();
-
-                    MarmaladeTag rootTag = script.getRoot();
-                    if ( rootTag instanceof MojoTag )
+                    catch ( IOException e )
                     {
-                        Map contextMap = new TreeMap();
-                        contextMap.put( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR, basedir );
-                        contextMap.put( MarmaladeMojoExecutionDirectives.PLUGIN_DESCRIPTOR, pluginDescriptor );
-
-                        MarmaladeExecutionContext context = new DefaultContext( contextMap );
-
-                        script.execute( context );
-
-                        contextMap = context.getExternalizedVariables();
-
-                        MojoDescriptor descriptor = (MojoDescriptor) contextMap
-                            .get( MarmaladeMojoExecutionDirectives.METADATA_OUTVAR );
-
-                        descriptors.add( descriptor );
+                        throw new PluginToolsException( "Error reading descriptor Marmalade mojo in: " + scriptFile, e );
                     }
-                    else
+                    catch ( MarmaladeLaunchException e )
                     {
-                        System.out.println( "This script is not a mojo. Its root tag is {element: "
-                            + rootTag.getTagInfo().getElement() + ", class: " + rootTag.getClass().getName() + "}" );
+                        throw new PluginToolsException( "Error extracting descriptor Marmalade mojo from: " + scriptFile, e );
                     }
                 }
             }
 
             return descriptors;
-        }
-        catch ( IOException e )
-        {
-            throw new PluginToolsException( "Error reading Marmalade for extracting mojo descriptor", e );
-        }
-        catch ( MarmaladeExecutionException e )
-        {
-            throw new PluginToolsException( "Error executing Marmalade for extracting mojo descriptor", e );
-        }
-        catch ( MarmaladeLaunchException e )
-        {
-            throw new PluginToolsException( "Error executing Marmalade for extracting mojo descriptor", e );
         }
         finally
         {

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractorTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractorTest.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractorTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-marmalade/src/test/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractorTest.java Thu May  5 17:32:08 2005
@@ -25,7 +25,7 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.Set;
+import java.util.List;
 
 /**
  * @author jdcasey
@@ -54,7 +54,7 @@
 
         PluginDescriptor pluginDescriptor = new PluginDescriptor();
         pluginDescriptor.setGoalPrefix( "test" );
-        Set descriptors = extractor.execute( project, pluginDescriptor );
+        List descriptors = extractor.execute( project, pluginDescriptor );
 
         assertEquals( 1, descriptors.size() );
 

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java Thu May  5 17:32:08 2005
@@ -28,11 +28,11 @@
 import org.apache.maven.tools.plugin.generator.jelly.JellyHarnessGenerator;
 import org.apache.maven.tools.plugin.scanner.DefaultMojoScanner;
 import org.apache.maven.tools.plugin.scanner.MojoScanner;
+import org.apache.maven.tools.plugin.util.PluginUtils;
 
 import java.io.File;
 import java.io.FileReader;
 import java.util.Collections;
-import java.util.Set;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -87,9 +87,17 @@
             Collections.singletonMap( "java", new JavaMojoDescriptorExtractor() ) );
 
         PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        
+        pluginDescriptor.setGroupId(project.getGroupId());
+        
+        pluginDescriptor.setArtifactId(project.getArtifactId());
+        
         // TODO: should read this from the pom...
         pluginDescriptor.setGoalPrefix( PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() ) );
-        Set descriptors = scanner.execute( project, pluginDescriptor );
+        
+        pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getDependencies() ) );
+        
+        scanner.populatePluginDescriptor( project, pluginDescriptor );
         
         // Create the generator.
         Generator generator = null;
@@ -113,6 +121,6 @@
 
         // Use the generator to process the discovered descriptors and produce
         // something with them.
-        generator.execute( outputDirectory, descriptors, project, pluginDescriptor.getGoalPrefix() );
+        generator.execute( outputDirectory, pluginDescriptor );
     }
 }

Modified: maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java Thu May  5 17:32:08 2005
@@ -20,12 +20,12 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.tools.plugin.PluginToolsException;
 import org.apache.maven.tools.plugin.generator.Generator;
 import org.apache.maven.tools.plugin.scanner.MojoScanner;
-import org.apache.maven.tools.plugin.PluginToolsException;
+import org.apache.maven.tools.plugin.util.PluginUtils;
 
 import java.io.IOException;
-import java.util.Set;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -70,13 +70,20 @@
 
         // TODO: could use this more, eg in the writing of the plugin descriptor!
         PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        
+        pluginDescriptor.setGroupId( project.getGroupId() );
+        
+        pluginDescriptor.setArtifactId( project.getArtifactId() );
+        
         pluginDescriptor.setGoalPrefix( goalPrefix );
 
         try
         {
-            Set mavenMojoDescriptors = mojoScanner.execute( project, pluginDescriptor );
+            pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getRuntimeDependencies() ) );
+            
+            mojoScanner.populatePluginDescriptor( project, pluginDescriptor );
 
-            createGenerator().execute( getOutputDirectory(), mavenMojoDescriptors, project, goalPrefix );
+            createGenerator().execute( getOutputDirectory(), pluginDescriptor );
         }
         catch ( IOException e )
         {

Modified: maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java Thu May  5 17:32:08 2005
@@ -16,12 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.generator.BeanGenerator;
-import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
 import org.apache.maven.tools.plugin.generator.Generator;
-
-import java.util.Set;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>

Modified: maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java Thu May  5 17:32:08 2005
@@ -16,12 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
 import org.apache.maven.tools.plugin.generator.Generator;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-
-import java.util.Set;
+import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
 
 /**
  * Generate a plugin descriptor.

Modified: maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java?rev=168481&r1=168480&r2=168481&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/JellyGeneratorMojo.java Thu May  5 17:32:08 2005
@@ -16,11 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.tools.plugin.generator.jelly.JellyHarnessGenerator;
 import org.apache.maven.tools.plugin.generator.Generator;
-
-import java.util.Set;
+import org.apache.maven.tools.plugin.generator.jelly.JellyHarnessGenerator;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org