o more javadoc
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@628966 13f79535-47bb-0310-9956-ffa450edef68master
parent
9130de2b14
commit
c0b1429c81
|
|
@ -36,14 +36,21 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts Mojo descriptors from <a href="http://ant.apache.org">Ant</a> sources.
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public class AntMojoDescriptorExtractor
|
public class AntMojoDescriptorExtractor
|
||||||
extends AbstractScriptedMojoDescriptorExtractor
|
extends AbstractScriptedMojoDescriptorExtractor
|
||||||
{
|
{
|
||||||
|
/** Default metada file extension */
|
||||||
private static final String METADATA_FILE_EXTENSION = ".mojos.xml";
|
private static final String METADATA_FILE_EXTENSION = ".mojos.xml";
|
||||||
|
|
||||||
|
/** Default Ant build file extension */
|
||||||
private static final String SCRIPT_FILE_EXTENSION = ".build.xml";
|
private static final String SCRIPT_FILE_EXTENSION = ".build.xml";
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir,
|
protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir,
|
||||||
PluginDescriptor pluginDescriptor )
|
PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
|
|
@ -156,11 +163,13 @@ public class AntMojoDescriptorExtractor
|
||||||
return descriptors;
|
return descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
protected String getScriptFileExtension()
|
protected String getScriptFileExtension()
|
||||||
{
|
{
|
||||||
return SCRIPT_FILE_EXTENSION;
|
return SCRIPT_FILE_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
protected String getMetadataFileExtension()
|
protected String getMetadataFileExtension()
|
||||||
{
|
{
|
||||||
return METADATA_FILE_EXTENSION;
|
return METADATA_FILE_EXTENSION;
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,13 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Extracts Mojo descriptors from <a href="http://www.beanshell.org/">BeanShell</a> sources.
|
||||||
|
*
|
||||||
* @todo share constants
|
* @todo share constants
|
||||||
* @todo add example usage tag that can be shown in the doco
|
* @todo add example usage tag that can be shown in the doco
|
||||||
* @todo need to add validation directives so that systems embedding maven2 can
|
* @todo need to add validation directives so that systems embedding maven2 can
|
||||||
* get validation directives to help users in IDEs.
|
* get validation directives to help users in IDEs.
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class BeanshellMojoDescriptorExtractor
|
public class BeanshellMojoDescriptorExtractor
|
||||||
extends AbstractScriptedMojoDescriptorExtractor
|
extends AbstractScriptedMojoDescriptorExtractor
|
||||||
|
|
@ -73,11 +76,13 @@ public class BeanshellMojoDescriptorExtractor
|
||||||
return mojoDescriptor;
|
return mojoDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
protected String getScriptFileExtension()
|
protected String getScriptFileExtension()
|
||||||
{
|
{
|
||||||
return ".bsh";
|
return ".bsh";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
|
protected List extractMojoDescriptors( Map scriptFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,40 +46,49 @@ import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts Mojo descriptors from Java sources.
|
* Extracts Mojo descriptors from <a href="http://java.sun.com/">Java</a> sources.
|
||||||
|
* <br/>
|
||||||
|
* For more information, have a look to:
|
||||||
|
* <a href="http://maven.apache.org/developers/mojo-api-specification.html">http://maven.apache.org/developers/mojo-api-specification.html</a>
|
||||||
*
|
*
|
||||||
* @todo add example usage tag that can be shown in the doco
|
* @todo add example usage tag that can be shown in the doco
|
||||||
* @todo need to add validation directives so that systems embedding maven2 can
|
* @todo need to add validation directives so that systems embedding maven2 can
|
||||||
* get validation directives to help users in IDEs.
|
* get validation directives to help users in IDEs.
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class JavaMojoDescriptorExtractor
|
public class JavaMojoDescriptorExtractor
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements MojoDescriptorExtractor
|
implements MojoDescriptorExtractor
|
||||||
{
|
{
|
||||||
|
/** Refer to <code>@instantiationStrategy</code> */
|
||||||
public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy";
|
public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy";
|
||||||
|
|
||||||
|
/** Refer to <code>@configurator</code> */
|
||||||
public static final String CONFIGURATOR = "configurator";
|
public static final String CONFIGURATOR = "configurator";
|
||||||
|
|
||||||
|
/** Refer to <code>@parameter</code> */
|
||||||
public static final String PARAMETER = "parameter";
|
public static final String PARAMETER = "parameter";
|
||||||
|
|
||||||
|
/** Refer to <code>expression</code> combined to <code>@parameter</code> */
|
||||||
public static final String PARAMETER_EXPRESSION = "expression";
|
public static final String PARAMETER_EXPRESSION = "expression";
|
||||||
|
|
||||||
|
/** Refer to <code>default-value</code> combined to <code>@parameter</code> */
|
||||||
public static final String PARAMETER_DEFAULT_VALUE = "default-value";
|
public static final String PARAMETER_DEFAULT_VALUE = "default-value";
|
||||||
|
|
||||||
|
/** Refer to <code>alias</code> combined to <code>@parameter</code> */
|
||||||
public static final String PARAMETER_ALIAS = "alias";
|
public static final String PARAMETER_ALIAS = "alias";
|
||||||
|
|
||||||
|
/** Refer to <code>@since</code> */
|
||||||
public static final String SINCE = "since";
|
public static final String SINCE = "since";
|
||||||
|
|
||||||
/**
|
/** This defines the default implementation in the case the parameter type is an interface.
|
||||||
* This defines the default implementation in the case the parameter type is an interface.
|
* Refer to <code>implementation</code> combined to @parameter */
|
||||||
*/
|
|
||||||
public static final String PARAMETER_IMPLEMENTATION = "implementation";
|
public static final String PARAMETER_IMPLEMENTATION = "implementation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates the base name of the bean properties used to read/write this parameter's value.
|
* This indicates the base name of the bean properties used to read/write this parameter's value.
|
||||||
* So:
|
* <br/>
|
||||||
*
|
* Refer to <code>@parameter property="project"</code>
|
||||||
* @parameter property="project"
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* Would say there is a getProject() method and a setProject(Project) method. Here the field
|
* Would say there is a getProject() method and a setProject(Project) method. Here the field
|
||||||
* name would not be the basis for the parameter's name. This mode of operation will allow the
|
* name would not be the basis for the parameter's name. This mode of operation will allow the
|
||||||
|
|
@ -87,48 +96,74 @@ public class JavaMojoDescriptorExtractor
|
||||||
*/
|
*/
|
||||||
public static final String PARAMETER_PROPERTY = "property";
|
public static final String PARAMETER_PROPERTY = "property";
|
||||||
|
|
||||||
|
/** Refer to <code>@required</code> */
|
||||||
public static final String REQUIRED = "required";
|
public static final String REQUIRED = "required";
|
||||||
|
|
||||||
|
/** Refer to <code>@deprecated</code> */
|
||||||
public static final String DEPRECATED = "deprecated";
|
public static final String DEPRECATED = "deprecated";
|
||||||
|
|
||||||
|
/** Refer to <code>@readonly</code> */
|
||||||
public static final String READONLY = "readonly";
|
public static final String READONLY = "readonly";
|
||||||
|
|
||||||
|
/** Refer to <code>@goal</code> */
|
||||||
public static final String GOAL = "goal";
|
public static final String GOAL = "goal";
|
||||||
|
|
||||||
|
/** Refer to <code>@phase</code> */
|
||||||
public static final String PHASE = "phase";
|
public static final String PHASE = "phase";
|
||||||
|
|
||||||
|
/** Refer to <code>@execute</code> */
|
||||||
public static final String EXECUTE = "execute";
|
public static final String EXECUTE = "execute";
|
||||||
|
|
||||||
|
/** Refer to <code>lifecycle</code> combined to <code>@execute</code> */
|
||||||
public static final String EXECUTE_LIFECYCLE = "lifecycle";
|
public static final String EXECUTE_LIFECYCLE = "lifecycle";
|
||||||
|
|
||||||
|
/** Refer to <code>phase</code> combined to <code>@execute</code> */
|
||||||
public static final String EXECUTE_PHASE = "phase";
|
public static final String EXECUTE_PHASE = "phase";
|
||||||
|
|
||||||
|
/** Refer to <code>goal</code> combined to <code>@execute</code> */
|
||||||
public static final String EXECUTE_GOAL = "goal";
|
public static final String EXECUTE_GOAL = "goal";
|
||||||
|
|
||||||
|
/** Refer to <code>@description</code> */
|
||||||
public static final String GOAL_DESCRIPTION = "description";
|
public static final String GOAL_DESCRIPTION = "description";
|
||||||
|
|
||||||
|
/** Refer to <code>requiresDependencyResolution</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution";
|
public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution";
|
||||||
|
|
||||||
|
/** Refer to <code>requiresProject</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
|
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
|
||||||
|
|
||||||
|
/** Refer to <code>requiresReports</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_REQUIRES_REPORTS = "requiresReports";
|
public static final String GOAL_REQUIRES_REPORTS = "requiresReports";
|
||||||
|
|
||||||
|
/** Refer to <code>aggregator</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_IS_AGGREGATOR = "aggregator";
|
public static final String GOAL_IS_AGGREGATOR = "aggregator";
|
||||||
|
|
||||||
|
/** Refer to <code>requiresOnline</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
|
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
|
||||||
|
|
||||||
|
/** Refer to <code>inheritByDefault</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault";
|
public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault";
|
||||||
|
|
||||||
|
/** Refer to <code>attainAlways</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_MULTI_EXECUTION_STRATEGY = "attainAlways";
|
public static final String GOAL_MULTI_EXECUTION_STRATEGY = "attainAlways";
|
||||||
|
|
||||||
|
/** Refer to <code>attainAlways</code> combined to <code>@goal</code> */
|
||||||
public static final String GOAL_REQUIRES_DIRECT_INVOCATION = "requiresDirectInvocation";
|
public static final String GOAL_REQUIRES_DIRECT_INVOCATION = "requiresDirectInvocation";
|
||||||
|
|
||||||
|
/** Refer to <code>@component</code> */
|
||||||
public static final String COMPONENT = "component";
|
public static final String COMPONENT = "component";
|
||||||
|
|
||||||
|
/** Refer to <code>role</code> combined to <code>@component</code> */
|
||||||
public static final String COMPONENT_ROLE = "role";
|
public static final String COMPONENT_ROLE = "role";
|
||||||
|
|
||||||
|
/** Refer to <code>roleHint</code> combined to <code>@component</code> */
|
||||||
public static final String COMPONENT_ROLEHINT = "roleHint";
|
public static final String COMPONENT_ROLEHINT = "roleHint";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parameter not null
|
||||||
|
* @param i
|
||||||
|
* @throws InvalidParameterException if any
|
||||||
|
*/
|
||||||
protected void validateParameter( Parameter parameter, int i )
|
protected void validateParameter( Parameter parameter, int i )
|
||||||
throws InvalidParameterException
|
throws InvalidParameterException
|
||||||
{
|
{
|
||||||
|
|
@ -161,6 +196,11 @@ public class JavaMojoDescriptorExtractor
|
||||||
// Mojo descriptor creation from @tags
|
// Mojo descriptor creation from @tags
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param javaClass not null
|
||||||
|
* @return a mojo descriptor
|
||||||
|
* @throws InvalidPluginDescriptorException if any
|
||||||
|
*/
|
||||||
protected MojoDescriptor createMojoDescriptor( JavaClass javaClass )
|
protected MojoDescriptor createMojoDescriptor( JavaClass javaClass )
|
||||||
throws InvalidPluginDescriptorException
|
throws InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
|
|
@ -543,6 +583,7 @@ public class JavaMojoDescriptorExtractor
|
||||||
return rawParams;
|
return rawParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
public List execute( MavenProject project, PluginDescriptor pluginDescriptor )
|
public List execute( MavenProject project, PluginDescriptor pluginDescriptor )
|
||||||
throws ExtractionException, InvalidPluginDescriptorException
|
throws ExtractionException, InvalidPluginDescriptorException
|
||||||
{
|
{
|
||||||
|
|
@ -569,8 +610,11 @@ public class JavaMojoDescriptorExtractor
|
||||||
return descriptors;
|
return descriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param project not null
|
||||||
|
* @return an array of java class
|
||||||
|
*/
|
||||||
protected JavaClass[] discoverClasses( final MavenProject project )
|
protected JavaClass[] discoverClasses( final MavenProject project )
|
||||||
throws ExtractionException
|
|
||||||
{
|
{
|
||||||
JavaDocBuilder builder = new JavaDocBuilder();
|
JavaDocBuilder builder = new JavaDocBuilder();
|
||||||
|
|
||||||
|
|
@ -589,6 +633,10 @@ public class JavaMojoDescriptorExtractor
|
||||||
return builder.getClasses();
|
return builder.getClasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mojoDescriptor not null
|
||||||
|
* @throws InvalidParameterException if any
|
||||||
|
*/
|
||||||
protected void validate( MojoDescriptor mojoDescriptor )
|
protected void validate( MojoDescriptor mojoDescriptor )
|
||||||
throws InvalidParameterException
|
throws InvalidParameterException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue