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/04/27 17:11:29 UTC

svn commit: r164990 - /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-java/src/main/java/org/apache/maven/tools/plugin/extractor/java /maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources

Author: jdcasey
Date: Wed Apr 27 08:11:28 2005
New Revision: 164990

URL: http://svn.apache.org/viewcvs?rev=164990&view=rev
Log:
Modifying the mojo generators to handle alias, and other missing elements where appropriate. Changed the resources mojos to be as trim as I can, and added @required to the field-level annotations (this might be a good thing to do for all plexus components, dunno if it's there already)...finally, trimmed up the annotation handling in the JavaMojoDescriptorExtractor to push as many annotation fields as possible into the endangered area, and started pulling as much info from the field, other companion annotations on the field, etc. as I can...I think the annotations are there, now. They need to be cleaned up after converting all the core plugins to use field-level annotations, then we're set.

Modified:
    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/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-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
    maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
    maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java

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=164990&r1=164989&r2=164990&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 Wed Apr 27 08:11:28 2005
@@ -33,6 +33,9 @@
 import java.util.Set;
 
 /**
+ * [JC] Is this class defunct now? I can't find o.a.m.plugin.BeanPluginAdapter in the codebase...
+ * I'm not going to edit this class to account for aliases, deprecation, etc. until I know.
+ * 
  * @todo use the descriptions in the descriptor for the javadoc pushed into the
  *       source code.
  */

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=164990&r1=164989&r2=164990&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 Wed Apr 27 08:11:28 2005
@@ -181,6 +181,11 @@
             w.startElement( "parameter" );
 
             element( w, "name", parameter.getName() );
+            
+            if( parameter.getAlias() != null )
+            {
+                element( w, "alias", parameter.getAlias() );
+            }
 
             element( w, "type", parameter.getType() );
 

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=164990&r1=164989&r2=164990&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 Wed Apr 27 08:11:28 2005
@@ -19,6 +19,7 @@
 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.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
@@ -37,7 +38,8 @@
 public class PluginXdocGenerator
     implements Generator
 {
-    public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project ) throws Exception
+    public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project )
+        throws Exception
     {
         for ( Iterator it = mojoDescriptors.iterator(); it.hasNext(); )
         {
@@ -137,7 +139,8 @@
         writer.close();
     }
 
-    private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w ) throws Exception
+    private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w )
+        throws Exception
     {
         w.startElement( "p" );
 
@@ -153,6 +156,12 @@
 
         w.startElement( "th" );
 
+        w.writeText( "Type" );
+
+        w.endElement();
+
+        w.startElement( "th" );
+
         w.writeText( "Expression" );
 
         w.endElement();
@@ -163,6 +172,18 @@
 
         w.endElement();
 
+        w.startElement( "th" );
+
+        w.writeText( "Required?" );
+
+        w.endElement();
+
+        w.startElement( "th" );
+
+        w.writeText( "Deprecated?" );
+
+        w.endElement();
+
         w.endElement();
 
         List parameters = mojoDescriptor.getParameters();
@@ -181,7 +202,24 @@
 
             w.startElement( "td" );
 
-            w.writeText( parameter.getName() );
+            String paramName = parameter.getAlias();
+
+            if ( StringUtils.isEmpty( paramName ) )
+            {
+                paramName = parameter.getName();
+            }
+
+            w.writeText( paramName );
+
+            w.endElement();
+
+            // ----------------------------------------------------------------------
+            //
+            // ----------------------------------------------------------------------
+
+            w.startElement( "td" );
+
+            w.writeText( parameter.getType() );
 
             w.endElement();
 
@@ -201,11 +239,33 @@
 
             w.startElement( "td" );
 
-            Parameter p = (Parameter) parameterMap.get( parameter.getName() );
+            w.writeText( parameter.getDescription() );
 
-            w.writeText( p.getDescription() );
+            w.endElement();
+
+            // ----------------------------------------------------------------------
+            //
+            // ----------------------------------------------------------------------
+
+            w.startElement( "td" );
+
+            w.writeText( Boolean.toString( parameter.isRequired() ) );
 
             w.endElement();
+
+            // ----------------------------------------------------------------------
+            //
+            // ----------------------------------------------------------------------
+
+            String deprecationWarning = parameter.getDeprecated();
+            if ( StringUtils.isNotEmpty( deprecationWarning ) )
+            {
+                w.startElement( "td" );
+
+                w.writeText( deprecationWarning );
+
+                w.endElement();
+            }
 
             w.endElement();
         }

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=164990&r1=164989&r2=164990&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 Wed Apr 27 08:11:28 2005
@@ -22,6 +22,7 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.generator.Generator;
 import org.apache.maven.tools.plugin.util.PluginUtils;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
@@ -194,7 +195,14 @@
         {
             Parameter parameter = (Parameter) parameters.get( i );
 
-            w.addAttribute( parameter.getName(), "${" + parameter.getName() + "}" );
+            String paramName = parameter.getAlias();
+            
+            if( StringUtils.isEmpty( paramName ) )
+            {
+                paramName = parameter.getName();
+            }
+            
+            w.addAttribute( paramName, "${" + paramName + "}" );
         }
 
         w.endElement();

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=164990&r1=164989&r2=164990&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 Wed Apr 27 08:11:28 2005
@@ -60,6 +60,12 @@
     public static final String MAVEN_PLUGIN_MODE = "maven.plugin.mode";
 
     public static final String PARAMETER = "parameter";
+    
+    public static final String PARAMETER_EXPRESSION = "expression";
+    
+    public static final String REQUIRED = "required";
+
+    public static final String DEPRECATED = "deprecated";
 
     public static final String GOAL = "goal";
 
@@ -298,6 +304,10 @@
                 pd.setDefaultValue( parameter.getNamedParameter( "default" ) );
                 
                 pd.setDescription( parameter.getNamedParameter( "description" ) );
+                
+                pd.setRequired( parameter.getNamedParameter( "required" ).equals( "true" ) ? true : false );
+                
+                pd.setDeprecated( parameter.getNamedParameter( "deprecated" ) );
             }
             else
             {
@@ -306,6 +316,14 @@
                 pd.setType( field.getType().getValue() );
                 
                 pd.setDescription( field.getComment() );
+                
+                pd.setRequired( field.getTagByName(REQUIRED) != null );
+                
+                DocletTag deprecationTag = field.getTagByName( DEPRECATED );
+                if( deprecationTag != null)
+                {
+                    pd.setDeprecated( deprecationTag.getValue() );
+                }
             }
 
             String alias = parameter.getNamedParameter( "alias" );
@@ -315,11 +333,7 @@
                 pd.setAlias( alias );
             }
 
-            pd.setRequired( parameter.getNamedParameter( "required" ).equals( "true" ) ? true : false );
-
-            pd.setExpression( parameter.getNamedParameter( "expression" ) );
-
-            pd.setDeprecated( parameter.getNamedParameter( "deprecated" ) );
+            pd.setExpression( parameter.getNamedParameter( PARAMETER_EXPRESSION ) );
 
             parameters.add( pd );
         }

Modified: maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java?rev=164990&r1=164989&r2=164990&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java Wed Apr 27 08:11:28 2005
@@ -46,18 +46,16 @@
     /**
      * The output directory into which to copy the resources.
      * 
-     * @parameter name="outputDirectory"
-     * required="true"
-     * expression="${project.build.outputDirectory}"
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
      */
     private String outputDirectory;
 
     /**
      * The list of resources we want to transfer.
      * 
-     * @parameter name="resources"
-     * required="true"
-     * expression="${project.build.resources}"
+     * @parameter expression="${project.build.resources}"
+     * @required
      */
     private List resources;
 

Modified: maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java?rev=164990&r1=164989&r2=164990&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/TestResourcesMojo.java Wed Apr 27 08:11:28 2005
@@ -33,18 +33,16 @@
     /**
      * The output directory into which to copy the resources.
      * 
-     * @parameter name="outputDirectory"
-     * required="true"
-     * expression="${project.build.testOutputDirectory}"
+     * @parameter expression="${project.build.testOutputDirectory}"
+     * @required
      */
     private String outputDirectory;
 
     /**
      * The list of resources we want to transfer.
      * 
-     * @parameter name="resources"
-     * required="true"
-     * expression="${project.build.testResources}"
+     * @parameter expression="${project.build.testResources}"
+     * @required
      */
     private List resources;
 



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