Author: jdcasey Date: Mon Sep 26 21:46:37 2005 New Revision: 291823 URL: http://svn.apache.org/viewcvs?rev=291823&view=rev Log: Working on: MNG-897...added AntMojoDescriptorExtractor, PluginMetadataParser, and made small changes to the plugin metadata model used by scripts like Ant. This should be complete, except for wiring into the tool front-ends and testing with an Ant-based plugin.
Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml (with props) maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java (with props) maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml (with props) maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java (with props) maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java (with props) maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo - copied, changed from r291797, maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/mojo-metadata.mdo Removed: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/mojo-metadata.mdo Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/pom.xml Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml?rev=291823&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml (added) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml Mon Sep 26 21:46:37 2005 @@ -0,0 +1,34 @@ +<project> + <parent> + <artifactId>maven-plugin-tools</artifactId> + <groupId>org.apache.maven</groupId> + <version>2.0-beta-3-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-tools-ant</artifactId> + <name>Maven Ant Plugin Tools</name> + <version>2.0-beta-3-SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-descriptor</artifactId> + <version>2.0-beta-3-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-tools-api</artifactId> + <version>2.0-beta-3-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-tools-model</artifactId> + <version>2.0-beta-3-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>plexus</groupId> + <artifactId>plexus-utils</artifactId> + </dependency> + </dependencies> +</project> Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java?rev=291823&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java (added) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java Mon Sep 26 21:46:37 2005 @@ -0,0 +1,105 @@ +package org.apache.maven.tools.plugin.extractor.ant; + +import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.tools.model.PluginMetadataParseException; +import org.apache.maven.plugin.tools.model.PluginMetadataParser; +import org.apache.maven.tools.plugin.extractor.AbstractScriptedMojoDescriptorExtractor; +import org.apache.maven.tools.plugin.extractor.ExtractionException; +import org.codehaus.plexus.util.StringUtils; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class AntMojoDescriptorExtractor + extends AbstractScriptedMojoDescriptorExtractor +{ + + private static final String METADATA_FILE_EXTENSION = ".plugin.xml"; + private static final String SCRIPT_FILE_EXTENSION = ".xml"; + + protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor ) + throws ExtractionException, InvalidPluginDescriptorException + { + List descriptors = new ArrayList(); + + PluginMetadataParser parser = new PluginMetadataParser(); + + for ( Iterator mapIterator = scriptFilesKeyedByBasedir.entrySet().iterator(); mapIterator.hasNext(); ) + { + Map.Entry entry = (Map.Entry) mapIterator.next(); + + String basedir = (String) entry.getKey(); + Set scriptFiles = (Set) entry.getValue(); + + for ( Iterator it = scriptFiles.iterator(); it.hasNext(); ) + { + File scriptMetadataFile = (File) it.next(); + + String basename = scriptMetadataFile.getName(); + basename = basename.substring( 0, basename.length() - METADATA_FILE_EXTENSION.length() ); + + File scriptFile = new File( scriptMetadataFile.getParentFile(), basename + SCRIPT_FILE_EXTENSION ); + + if ( !scriptFile.exists() ) + { + throw new InvalidPluginDescriptorException( "Found orphaned plugin metadata file: " + scriptMetadataFile ); + } + + String relativePath = null; + + if ( basedir.endsWith( "/" ) ) + { + basedir = basedir.substring( 0, basedir.length() - 2 ); + } + + relativePath = scriptFile.getPath().substring( basedir.length() ); + + relativePath = relativePath.replace( '\\', '/' ); + + try + { + Set mojoDescriptors = parser.parseMojoDescriptors( scriptMetadataFile ); + + for ( Iterator discoveredMojoIterator = mojoDescriptors.iterator(); discoveredMojoIterator.hasNext(); ) + { + MojoDescriptor descriptor = (MojoDescriptor) discoveredMojoIterator.next(); + + + String implementation = relativePath; + + if ( StringUtils.isNotEmpty( descriptor.getImplementation() ) ) + { + implementation += ":" + descriptor.getImplementation(); + } + + descriptor.setImplementation( implementation ); + + descriptor.setLanguage( "ant" ); + descriptor.setComponentComposer( "map-oriented" ); + descriptor.setComponentConfigurator( "map-oriented" ); + + descriptors.add( descriptor ); + } + } + catch ( PluginMetadataParseException e ) + { + throw new ExtractionException( "Error extracting mojo descriptor from script: " + scriptMetadataFile, e ); + } + } + } + + return descriptors; + } + + protected String getScriptFileExtension() + { + return METADATA_FILE_EXTENSION; + } + +} Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractor.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml?rev=291823&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml (added) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml Mon Sep 26 21:46:37 2005 @@ -0,0 +1,17 @@ +<component-set> + <components> + + <!-- + | + | JavaMojoDescriptorExtractor, a MojoDescriptor extractor to read + | descriptors from java sources. + | + --> + <component> + <role>org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor</role> + <role-hint>ant</role-hint> + <implementation>org.apache.maven.tools.plugin.extractor.ant.AntMojoDescriptorExtractor</implementation> + </component> + + </components> +</component-set> \ No newline at end of file Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-ant/src/main/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/pom.xml?rev=291823&r1=291822&r2=291823&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/pom.xml (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/pom.xml Mon Sep 26 21:46:37 2005 @@ -1,20 +1,28 @@ <project> <parent> - <artifactId>maven</artifactId> + <artifactId>maven-plugin-tools</artifactId> <groupId>org.apache.maven</groupId> - <version>2.0-beta-2-SNAPSHOT</version> + <version>2.0-beta-3-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-tools-model</artifactId> <name>Maven Plugin Metadata Model</name> - <version>2.0-beta-2-SNAPSHOT</version> + <version>2.0-beta-3-SNAPSHOT</version> <dependencies> <dependency> <groupId>plexus</groupId> + <artifactId>plexus-container-default</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-descriptor</artifactId> + <version>2.0-beta-3-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>plexus</groupId> <artifactId>plexus-utils</artifactId> - <version>1.0.3</version> </dependency> </dependencies> @@ -23,7 +31,6 @@ <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> - <version>RELEASE</version> <executions> <execution> <goals> @@ -34,7 +41,7 @@ </execution> </executions> <configuration> - <model>src/main/mdo/mojo-metadata.mdo</model> + <model>src/main/mdo/plugin-metadata.mdo</model> <version>1.0.0</version> </configuration> </plugin> Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java?rev=291823&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java (added) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java Mon Sep 26 21:46:37 2005 @@ -0,0 +1,40 @@ +package org.apache.maven.plugin.tools.model; + +import java.io.File; + +public class PluginMetadataParseException + extends Exception +{ + + static final long serialVersionUID = 1; + + private final File metadataFile; + private final String originalMessage; + + public PluginMetadataParseException( File metadataFile, String message, Throwable cause ) + { + super( "Error parsing file: " + metadataFile + ". Reason: " + message, cause ); + + this.metadataFile = metadataFile; + this.originalMessage = message; + } + + public PluginMetadataParseException( File metadataFile, String message ) + { + super( "Error parsing file: " + metadataFile + ". Reason: " + message ); + + this.metadataFile = metadataFile; + this.originalMessage = message; + } + + public File getMetadataFile() + { + return metadataFile; + } + + public String getOriginalMessage() + { + return originalMessage; + } + +} Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java?rev=291823&view=auto ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java (added) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java Mon Sep 26 21:46:37 2005 @@ -0,0 +1,158 @@ +package org.apache.maven.plugin.tools.model; + +import org.apache.maven.plugin.descriptor.DuplicateParameterException; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.tools.model.io.xpp3.PluginMetadataXpp3Reader; +import org.codehaus.plexus.component.repository.ComponentRequirement; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class PluginMetadataParser +{ + + public Set parseMojoDescriptors( File metadataFile ) + throws PluginMetadataParseException + { + Set descriptors = new HashSet(); + + Reader reader = null; + + try + { + reader = new FileReader( metadataFile ); + + PluginMetadataXpp3Reader metadataReader = new PluginMetadataXpp3Reader(); + + PluginMetadata pluginMetadata = metadataReader.read( reader ); + + List mojos = pluginMetadata.getMojos(); + + if ( mojos != null && !mojos.isEmpty() ) + { + for ( Iterator it = mojos.iterator(); it.hasNext(); ) + { + Mojo mojo = (Mojo) it.next(); + + MojoDescriptor descriptor = asDescriptor( metadataFile, mojo ); + + descriptors.add( descriptor ); + } + } + } + catch ( IOException e ) + { + throw new PluginMetadataParseException( metadataFile, "Cannot parse plugin metadata from file.", e ); + } + catch ( XmlPullParserException e ) + { + throw new PluginMetadataParseException( metadataFile, "Cannot parse plugin metadata from file.", e ); + } + finally + { + IOUtil.close( reader ); + } + + return descriptors; + } + + private MojoDescriptor asDescriptor( File metadataFile, Mojo mojo ) + throws PluginMetadataParseException + { + MojoDescriptor descriptor = new MojoDescriptor(); + + descriptor.setImplementation( mojo.getCall() ); + + descriptor.setGoal( mojo.getGoal() ); + descriptor.setPhase( mojo.getPhase() ); + descriptor.setDependencyResolutionRequired( mojo.getRequiresDependencyResolution() ); + descriptor.setAggregator( mojo.isAggregator() ); + descriptor.setInheritedByDefault( mojo.isInheritByDefault() ); + descriptor.setDirectInvocationOnly( mojo.isRequiresDirectInvocation() ); + descriptor.setOnlineRequired( mojo.isRequiresOnline() ); + descriptor.setProjectRequired( mojo.isRequiresProject() ); + descriptor.setRequiresReports( mojo.isRequiresReports() ); + descriptor.setDescription( mojo.getDescription() ); + descriptor.setDeprecated( mojo.getDeprecation() ); + + LifecycleExecution le = mojo.getExecution(); + if ( le != null ) + { + descriptor.setExecuteLifecycle( le.getLifecycle() ); + descriptor.setExecutePhase( le.getPhase() ); + } + + List parameters = mojo.getParameters(); + + if ( parameters != null && !parameters.isEmpty() ) + { + for ( Iterator it = parameters.iterator(); it.hasNext(); ) + { + org.apache.maven.plugin.tools.model.Parameter param = (org.apache.maven.plugin.tools.model.Parameter) it.next(); + + Parameter dParam = new Parameter(); + dParam.setAlias( param.getAlias() ); + dParam.setDeprecated( param.getDeprecation() ); + dParam.setDescription( param.getDescription() ); + dParam.setEditable( !param.isReadonly() ); + dParam.setExpression( param.getExpression() ); + + String property = param.getProperty(); + if ( StringUtils.isNotEmpty( property ) ) + { + dParam.setName( property ); + } + else + { + dParam.setName( param.getName() ); + } + + if ( StringUtils.isEmpty( dParam.getName() ) ) + { + throw new PluginMetadataParseException( metadataFile, "Mojo: \'" + mojo.getGoal() + "\' has a parameter without either property or name attributes. Please specify one." ); + } + + dParam.setRequired( param.isRequired() ); + dParam.setType( param.getType() ); + + try + { + descriptor.addParameter( dParam ); + } + catch ( DuplicateParameterException e ) + { + throw new PluginMetadataParseException( metadataFile, "Duplicate parameters detected for mojo: " + mojo.getGoal(), e ); + } + } + } + + List components = mojo.getComponents(); + + if ( components != null && !components.isEmpty() ) + { + for ( Iterator it = components.iterator(); it.hasNext(); ) + { + Component component = (Component) it.next(); + + ComponentRequirement cr = new ComponentRequirement(); + cr.setRole( component.getRole() ); + cr.setRoleHint( component.getHint() ); + + descriptor.addRequirement( cr ); + } + } + + return descriptor; + } + +} Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Copied: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo (from r291797, maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/mojo-metadata.mdo) URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo?p2=maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo&p1=maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/mojo-metadata.mdo&r1=291797&r2=291823&rev=291823&view=diff ============================================================================== --- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/mojo-metadata.mdo (original) +++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo Mon Sep 26 21:46:37 2005 @@ -1,41 +1,45 @@ <!-- - <mojoMetadata goal="myGoal" - phase="compile" - requiresDependencyResolution="compile" - requiresProject="true" - requiresReports="true" - requiresOnline="true" - inheritByDefault="true" - requiresDirectInvocation="true" - aggregator="true"> + <pluginMetadata> + <mojos> + <mojo goal="myGoal" + phase="compile" + requiresDependencyResolution="compile" + requiresProject="true" + requiresReports="true" + requiresOnline="true" + inheritByDefault="true" + requiresDirectInvocation="true" + aggregator="true"> - <execute phase="initialize" lifecycle="mine"/> - <components> - <component role="stuff" hint="more"/> - </components> - <parameters> - <parameter name="nom" - property="prop" - required="true" - readonly="true" - expression="${project}" - type="org.apache.maven.project.MavenProject" - alias="otherProp"> - <description>Test parameter</description> - <deprecated>Use something else</deprecated> - </parameter> - </parameters> - <description> - This is a test. - </description> - <deprecated>Use another mojo</deprecated> - </mojoMetadata> + <execute phase="initialize" lifecycle="mine"/> + <components> + <component role="stuff" hint="more"/> + </components> + <parameters> + <parameter name="nom" + property="prop" + required="true" + readonly="true" + expression="${project}" + type="org.apache.maven.project.MavenProject" + alias="otherProp"> + <description>Test parameter</description> + <deprecated>Use something else</deprecated> + </parameter> + </parameters> + <description> + This is a test. + </description> + <deprecated>Use another mojo</deprecated> + </mojo> + </mojos> + </pluginMetadata> --> <model> - <id>mojo-metadata</id> - <name>MojoMetadata</name> + <id>plugin-metadata</id> + <name>PluginMetadata</name> <description><![CDATA[ - Mojo descriptor for embedding in scripts. + Plugin descriptor metadata for using with script-based mojos. ]]></description> <defaults> <default> @@ -44,10 +48,27 @@ </default> </defaults> <classes> - <class rootElement="true" xml.tagName="mojoMetadata"> - <name>MojoMetadata</name> + <class rootElement="true" xml.tagName="pluginMetadata"> + <name>PluginMetadata</name> <version>1.0.0</version> - <description>Root element of the XML-based mojo descriptor definition.</description> + <description>Root element of a script-based mojo's plugin metadata bindings.</description> + <fields> + <field> + <name>mojos</name> + <version>1.0.0</version> + <required>true</required> + <description>The list of mojos contained in the accompanying script.</description> + <association> + <type>Mojo</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + <class> + <name>Mojo</name> + <version>1.0.0</version> + <description>Mojo descriptor definition.</description> <fields> <field xml.attribute="true"> <version>1.0.0</version> @@ -136,12 +157,18 @@ <description>The description for this parameter.</description> <type>String</type> </field> - <field> + <field xml.tagName="deprecated"> <name>deprecation</name> <version>1.0.0</version> <description>A deprecation message for this mojo parameter.</description> <type>String</type> </field> + <field xml.attribute="true"> + <version>1.0.0</version> + <name>call</name> + <type>String</type> + <description>The target/method within the script to call when this mojo executes.</description> + </field> </fields> </class> <class> @@ -252,7 +279,7 @@ <description>The description for this parameter.</description> <type>String</type> </field> - <field> + <field xml.tagName="deprecated"> <name>deprecation</name> <version>1.0.0</version> <description>A deprecation message for this mojo parameter.</description> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]