org.apache.maven.plugin.plugin
Class AbstractGeneratorMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.plugin.AbstractGeneratorMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
DescriptorGeneratorMojo, HelpGeneratorMojo, XdocGeneratorMojo

public abstract class AbstractGeneratorMojo
extends org.apache.maven.plugin.AbstractMojo

Abstract class for this Plugin.

Version:
$Id: AbstractGeneratorMojo.java 1338429 2012-05-14 21:18:44Z hboutemy $
Author:
Jason van Zyl

Field Summary
protected  Set<org.apache.maven.artifact.Artifact> dependencies
          The set of dependencies for the current project
protected  String encoding
          The file encoding of the source files.
protected  Set<String> extractors
          The role names of mojo extractors to use.
protected  String goalPrefix
          The goal prefix that will appear before the ":".
protected  org.apache.maven.artifact.repository.ArtifactRepository local
          Location of the local repository.
protected  MojoScanner mojoScanner
          The component used for scanning the source tree for mojos.
protected  org.apache.maven.project.MavenProject project
          The project currently being built.
protected  List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
          List of Remote Repositories used by the resolver
protected  boolean skip
          Set this to "true" to skip invoking any goals or reports of the plugin.
protected  boolean skipErrorNoDescriptorsFound
          By default an exception is throw if no mojo descriptor is found.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractGeneratorMojo()
           
 
Method Summary
protected abstract  Generator createGenerator()
           
 void execute()
          
protected abstract  File getOutputDirectory()
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

protected org.apache.maven.project.MavenProject project
The project currently being built.

Is defined by:
default-value:
${project}
Is readonly.
Is required.

mojoScanner

protected MojoScanner mojoScanner
The component used for scanning the source tree for mojos.

Is a Plexus component defined by:
Is required.

encoding

protected String encoding
The file encoding of the source files.

Since:
2.5
Is defined by:
expression:
${encoding}
default-value:
${project.build.sourceEncoding}

goalPrefix

protected String goalPrefix
The goal prefix that will appear before the ":".

Is defined by:

skipErrorNoDescriptorsFound

protected boolean skipErrorNoDescriptorsFound
By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the descriptor generator mojo is bound to generate-resources phase. But for annotations, the compiled classes are needed, so skip error

Since:
3.0
Is defined by:
expression:
${maven.plugin.skipErrorNoDescriptorsFound}
default-value:
false

extractors

protected Set<String> extractors
The role names of mojo extractors to use.

If not set, all mojo extractors will be used. If set to an empty extractor name, no mojo extractors will be used.

Example:

  <!-- Use all mojo extractors -->
  <extractors/>

  <!-- Use no mojo extractors -->
  <extractors>
      <extractor/>
  </extractors>

  <!-- Use only bsh mojo extractor -->
  <extractors>
      <extractor>bsh</extractor>
  </extractors>
 

Is defined by:

skip

protected boolean skip
Set this to "true" to skip invoking any goals or reports of the plugin.

Since:
2.8
Is defined by:
expression:
${maven.plugin.skip}
default-value:
false

dependencies

protected Set<org.apache.maven.artifact.Artifact> dependencies
The set of dependencies for the current project


remoteRepos

protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
List of Remote Repositories used by the resolver

Since:
3.0
Is defined by:
expression:
${project.remoteArtifactRepositories}
Is readonly.
Is required.

local

protected org.apache.maven.artifact.repository.ArtifactRepository local
Location of the local repository.

Since:
3.0
Is defined by:
expression:
${localRepository}
Is readonly.
Is required.
Constructor Detail

AbstractGeneratorMojo

public AbstractGeneratorMojo()
Method Detail

getOutputDirectory

protected abstract File getOutputDirectory()
Returns:
the output directory where files will be generated.

createGenerator

protected abstract Generator createGenerator()
Returns:
the wanted Generator implementation.

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException

Throws:
org.apache.maven.plugin.MojoExecutionException


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.