org.apache.maven.tools.plugin.extractor.java
Class JavaMojoDescriptorExtractor

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor
All Implemented Interfaces:
JavaMojoAnnotation, MojoDescriptorExtractor, org.codehaus.plexus.logging.LogEnabled

public class JavaMojoDescriptorExtractor
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements MojoDescriptorExtractor, JavaMojoAnnotation

Extracts Mojo descriptors from Java sources.
For more information about the usage tag, have a look to: http://maven.apache.org/developers/mojo-api-specification.html

Version:
$Id: JavaMojoDescriptorExtractor.java 685111 2008-08-12 10:38:09Z vsiveton $
See Also:
MojoDescriptor

Field Summary
static java.lang.String COMPONENT
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT instead of.
static java.lang.String COMPONENT_ROLE
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLE instead of.
static java.lang.String COMPONENT_ROLEHINT
          Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLEHINT instead of.
static java.lang.String CONFIGURATOR
          Deprecated. since 2.4, use JavaMojoAnnotation.CONFIGURATOR instead of.
static java.lang.String DEPRECATED
          Deprecated. since 2.4, use JavaMojoAnnotation.DEPRECATED instead of.
static java.lang.String EXECUTE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE instead of.
static java.lang.String EXECUTE_GOAL
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_GOAL instead of.
static java.lang.String EXECUTE_LIFECYCLE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_LIFECYCLE instead of.
static java.lang.String EXECUTE_PHASE
          Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_PHASE instead of.
static java.lang.String GOAL
          Deprecated. since 2.4, use JavaMojoAnnotation.GOAL instead of.
static java.lang.String GOAL_DESCRIPTION
          Deprecated. since 2.4, use JavaMojoAnnotation.DESCRIPTION instead of.
static java.lang.String GOAL_INHERIT_BY_DEFAULT
          Deprecated. since 2.4, use JavaMojoAnnotation.INHERIT_BY_DEFAULT instead of.
static java.lang.String GOAL_IS_AGGREGATOR
          Deprecated. since 2.4, use JavaMojoAnnotation.AGGREGATOR instead of.
static java.lang.String GOAL_MULTI_EXECUTION_STRATEGY
          Deprecated. since 2.4, use JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY instead of.
static java.lang.String GOAL_REQUIRES_DEPENDENCY_RESOLUTION
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION instead of.
static java.lang.String GOAL_REQUIRES_DIRECT_INVOCATION
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION instead of.
static java.lang.String GOAL_REQUIRES_ONLINE
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_ONLINE instead of.
static java.lang.String GOAL_REQUIRES_PROJECT
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_PROJECT instead of.
static java.lang.String GOAL_REQUIRES_REPORTS
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_REPORTS instead of.
static java.lang.String MAVEN_PLUGIN_INSTANTIATION
          Deprecated. since 2.4, use JavaMojoAnnotation.INSTANTIATION_STRATEGY instead of.
static java.lang.String PARAMETER
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER instead of.
static java.lang.String PARAMETER_ALIAS
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_ALIAS instead of.
static java.lang.String PARAMETER_DEFAULT_VALUE
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_DEFAULT_VALUE instead of.
static java.lang.String PARAMETER_EXPRESSION
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_EXPRESSION instead of.
static java.lang.String PARAMETER_IMPLEMENTATION
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_IMPLEMENTATION instead of.
static java.lang.String PARAMETER_PROPERTY
          Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_PROPERTY instead of.
static java.lang.String PHASE
          Deprecated. since 2.4, use JavaMojoAnnotation.PHASE instead of.
static java.lang.String READONLY
          Deprecated. since 2.4, use JavaMojoAnnotation.READONLY instead of.
static java.lang.String REQUIRED
          Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRED instead of.
static java.lang.String SINCE
          Deprecated. since 2.4, use JavaMojoAnnotation.SINCE instead of.
 
Fields inherited from interface org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor
ROLE
 
Fields inherited from interface org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation
AGGREGATOR, DESCRIPTION, EXECUTION_STATEGY, IMPLEMENTATION, INHERIT_BY_DEFAULT, INSTANTIATION_STRATEGY, LANGUAGE, MULTI_EXECUTION_STRATEGY, REQUIRES_DEPENDENCY_RESOLUTION, REQUIRES_DIRECT_INVOCATION, REQUIRES_ONLINE, REQUIRES_PROJECT, REQUIRES_REPORTS
 
Constructor Summary
JavaMojoDescriptorExtractor()
           
 
Method Summary
protected  org.apache.maven.plugin.descriptor.MojoDescriptor createMojoDescriptor(com.thoughtworks.qdox.model.JavaClass javaClass)
           
protected  com.thoughtworks.qdox.model.JavaClass[] discoverClasses(org.apache.maven.project.MavenProject project)
           
 java.util.List execute(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
          Execute the mojo extraction.
protected  void validate(org.apache.maven.plugin.descriptor.MojoDescriptor mojoDescriptor)
           
protected  void validateParameter(org.apache.maven.plugin.descriptor.Parameter parameter, int i)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAVEN_PLUGIN_INSTANTIATION

public static final java.lang.String MAVEN_PLUGIN_INSTANTIATION
Deprecated. since 2.4, use JavaMojoAnnotation.INSTANTIATION_STRATEGY instead of.
See Also:
Constant Field Values

CONFIGURATOR

public static final java.lang.String CONFIGURATOR
Deprecated. since 2.4, use JavaMojoAnnotation.CONFIGURATOR instead of.
See Also:
Constant Field Values

PARAMETER

public static final java.lang.String PARAMETER
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER instead of.
See Also:
Constant Field Values

PARAMETER_EXPRESSION

public static final java.lang.String PARAMETER_EXPRESSION
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_EXPRESSION instead of.
See Also:
Constant Field Values

PARAMETER_DEFAULT_VALUE

public static final java.lang.String PARAMETER_DEFAULT_VALUE
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_DEFAULT_VALUE instead of.
See Also:
Constant Field Values

PARAMETER_ALIAS

public static final java.lang.String PARAMETER_ALIAS
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_ALIAS instead of.
See Also:
Constant Field Values

SINCE

public static final java.lang.String SINCE
Deprecated. since 2.4, use JavaMojoAnnotation.SINCE instead of.
See Also:
Constant Field Values

PARAMETER_IMPLEMENTATION

public static final java.lang.String PARAMETER_IMPLEMENTATION
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_IMPLEMENTATION instead of.
See Also:
Constant Field Values

PARAMETER_PROPERTY

public static final java.lang.String PARAMETER_PROPERTY
Deprecated. since 2.4, use JavaMojoAnnotation.PARAMETER_PROPERTY instead of.
See Also:
Constant Field Values

REQUIRED

public static final java.lang.String REQUIRED
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRED instead of.
See Also:
Constant Field Values

DEPRECATED

public static final java.lang.String DEPRECATED
Deprecated. since 2.4, use JavaMojoAnnotation.DEPRECATED instead of.
See Also:
Constant Field Values

READONLY

public static final java.lang.String READONLY
Deprecated. since 2.4, use JavaMojoAnnotation.READONLY instead of.
See Also:
Constant Field Values

GOAL

public static final java.lang.String GOAL
Deprecated. since 2.4, use JavaMojoAnnotation.GOAL instead of.
See Also:
Constant Field Values

PHASE

public static final java.lang.String PHASE
Deprecated. since 2.4, use JavaMojoAnnotation.PHASE instead of.
See Also:
Constant Field Values

EXECUTE

public static final java.lang.String EXECUTE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE instead of.
See Also:
Constant Field Values

EXECUTE_LIFECYCLE

public static final java.lang.String EXECUTE_LIFECYCLE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_LIFECYCLE instead of.
See Also:
Constant Field Values

EXECUTE_PHASE

public static final java.lang.String EXECUTE_PHASE
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_PHASE instead of.
See Also:
Constant Field Values

EXECUTE_GOAL

public static final java.lang.String EXECUTE_GOAL
Deprecated. since 2.4, use JavaMojoAnnotation.EXECUTE_GOAL instead of.
See Also:
Constant Field Values

GOAL_DESCRIPTION

public static final java.lang.String GOAL_DESCRIPTION
Deprecated. since 2.4, use JavaMojoAnnotation.DESCRIPTION instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_DEPENDENCY_RESOLUTION

public static final java.lang.String GOAL_REQUIRES_DEPENDENCY_RESOLUTION
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_PROJECT

public static final java.lang.String GOAL_REQUIRES_PROJECT
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_PROJECT instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_REPORTS

public static final java.lang.String GOAL_REQUIRES_REPORTS
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_REPORTS instead of.
See Also:
Constant Field Values

GOAL_IS_AGGREGATOR

public static final java.lang.String GOAL_IS_AGGREGATOR
Deprecated. since 2.4, use JavaMojoAnnotation.AGGREGATOR instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_ONLINE

public static final java.lang.String GOAL_REQUIRES_ONLINE
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_ONLINE instead of.
See Also:
Constant Field Values

GOAL_INHERIT_BY_DEFAULT

public static final java.lang.String GOAL_INHERIT_BY_DEFAULT
Deprecated. since 2.4, use JavaMojoAnnotation.INHERIT_BY_DEFAULT instead of.
See Also:
Constant Field Values

GOAL_MULTI_EXECUTION_STRATEGY

public static final java.lang.String GOAL_MULTI_EXECUTION_STRATEGY
Deprecated. since 2.4, use JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY instead of.
See Also:
Constant Field Values

GOAL_REQUIRES_DIRECT_INVOCATION

public static final java.lang.String GOAL_REQUIRES_DIRECT_INVOCATION
Deprecated. since 2.4, use JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION instead of.
See Also:
Constant Field Values

COMPONENT

public static final java.lang.String COMPONENT
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT instead of.
See Also:
Constant Field Values

COMPONENT_ROLE

public static final java.lang.String COMPONENT_ROLE
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLE instead of.
See Also:
Constant Field Values

COMPONENT_ROLEHINT

public static final java.lang.String COMPONENT_ROLEHINT
Deprecated. since 2.4, use JavaMojoAnnotation.COMPONENT_ROLEHINT instead of.
See Also:
Constant Field Values
Constructor Detail

JavaMojoDescriptorExtractor

public JavaMojoDescriptorExtractor()
Method Detail

validateParameter

protected void validateParameter(org.apache.maven.plugin.descriptor.Parameter parameter,
                                 int i)
                          throws org.apache.maven.plugin.descriptor.InvalidParameterException
Parameters:
parameter - not null
i - positive number
Throws:
org.apache.maven.plugin.descriptor.InvalidParameterException - if any

createMojoDescriptor

protected org.apache.maven.plugin.descriptor.MojoDescriptor createMojoDescriptor(com.thoughtworks.qdox.model.JavaClass javaClass)
                                                                          throws org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
Parameters:
javaClass - not null
Returns:
a mojo descriptor
Throws:
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any

execute

public java.util.List execute(org.apache.maven.project.MavenProject project,
                              org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
                       throws ExtractionException,
                              org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
Execute the mojo extraction.

Specified by:
execute in interface MojoDescriptorExtractor
Parameters:
project - not null Maven project
pluginDescriptor - not null plugin descriptor
Returns:
a list of mojo descriptors.
Throws:
ExtractionException - if any
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any

discoverClasses

protected com.thoughtworks.qdox.model.JavaClass[] discoverClasses(org.apache.maven.project.MavenProject project)
Parameters:
project - not null
Returns:
an array of java class

validate

protected void validate(org.apache.maven.plugin.descriptor.MojoDescriptor mojoDescriptor)
                 throws org.apache.maven.plugin.descriptor.InvalidParameterException
Parameters:
mojoDescriptor - not null
Throws:
org.apache.maven.plugin.descriptor.InvalidParameterException - if any


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.