Package org.apache.maven.plugin.plugin
Class AbstractGeneratorMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.plugin.AbstractGeneratorMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
DescriptorGeneratorMojo,HelpGeneratorMojo
public abstract class AbstractGeneratorMojo extends org.apache.maven.plugin.AbstractMojoAbstract class for this Plugin.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.sonatype.plexus.build.incremental.BuildContextbuildContextprivate booleancheckExpectedProvidedScopeFlag controlling is "expected dependencies in provided scope" check to be performed or not.protected java.lang.StringencodingThe file encoding of the source files.private java.util.List<java.lang.String>expectedProvidedScopeExclusionsList ofgroupId:artifactIdstrings of artifact coordinates that are to be excluded from "expected provided scope" check.private java.util.List<java.lang.String>expectedProvidedScopeGroupIdsList ofgroupIdstrings of artifact coordinates that are expected to be in "provided" scope.protected java.util.Set<java.lang.String>extractorsThe role names of mojo extractors to use.protected java.lang.StringgoalPrefixThe goal prefix that will appear before the ":".protected org.apache.maven.artifact.repository.ArtifactRepositorylocalLocation of the local repository.private static java.lang.StringLSSystem/OS line separator: used to format console messages.private java.util.List<java.lang.String>mojoDependenciesSpecify the dependencies asgroupId:artifactIdcontaining (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis.protected MojoScannermojoScannerThe component used for scanning the source tree for mojos.protected java.util.List<java.lang.String>packagingTypesMaven plugin packaging types.protected org.apache.maven.project.MavenProjectprojectThe project currently being built.protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository>remoteReposList of Remote Repositories used by the resolverprotected booleanskipSet this to "true" to skip invoking any goals or reports of the plugin.protected booleanskipErrorNoDescriptorsFoundBy default an exception is throw if no mojo descriptor is found.
-
Constructor Summary
Constructors Constructor Description AbstractGeneratorMojo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract GeneratorcreateGenerator()private java.util.Set<org.apache.maven.artifact.Artifact>dependenciesNotInProvidedScope()Collects all dependencies expected to be in "provided" scope but are NOT in "provided" scope.voidexecute()private java.util.Set<org.apache.maven.artifact.Artifact>filterMojoDependencies()Get dependencies filtered with mojoDependencies configuration.(package private) static java.lang.StringgetDefaultGoalPrefix(org.apache.maven.project.MavenProject project)protected abstract java.io.FilegetOutputDirectory()
-
-
-
Field Detail
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
The project currently being built.
-
mojoScanner
@Component protected MojoScanner mojoScanner
The component used for scanning the source tree for mojos.
-
buildContext
@Component protected org.sonatype.plexus.build.incremental.BuildContext buildContext
-
encoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") protected java.lang.String encoding
The file encoding of the source files.- Since:
- 2.5
-
goalPrefix
@Parameter protected java.lang.String goalPrefix
The goal prefix that will appear before the ":".
-
skipErrorNoDescriptorsFound
@Parameter(property="maven.plugin.skipErrorNoDescriptorsFound", defaultValue="false") 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
-
extractors
@Parameter protected java.util.Set<java.lang.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>
-
skip
@Parameter(defaultValue="false", property="maven.plugin.skip") protected boolean skip
Set this to "true" to skip invoking any goals or reports of the plugin.- Since:
- 2.8
-
mojoDependencies
@Parameter private java.util.List<java.lang.String> mojoDependencies
Specify the dependencies asgroupId:artifactIdcontaining (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis. By default, the value isnulland all dependencies are scanned (as before this parameter was added). If specified in the configuration with no children, no dependencies are scanned.- Since:
- 3.5
-
remoteRepos
@Parameter(defaultValue="${project.remoteArtifactRepositories}", required=true, readonly=true) protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
List of Remote Repositories used by the resolver- Since:
- 3.0
-
local
@Parameter(defaultValue="${localRepository}", required=true, readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository local
Location of the local repository.- Since:
- 3.0
-
packagingTypes
@Parameter protected java.util.List<java.lang.String> packagingTypes
Maven plugin packaging types. Default is single "maven-plugin".- Since:
- 3.3
-
checkExpectedProvidedScope
@Parameter(defaultValue="true", property="maven.plugin.checkExpectedProvidedScope") private boolean checkExpectedProvidedScope
Flag controlling is "expected dependencies in provided scope" check to be performed or not. Default value:true.- Since:
- 3.6.3
-
expectedProvidedScopeGroupIds
@Parameter private java.util.List<java.lang.String> expectedProvidedScopeGroupIds
List ofgroupIdstrings of artifact coordinates that are expected to be in "provided" scope. Default value:["org.apache.maven"].- Since:
- 3.6.3
-
expectedProvidedScopeExclusions
@Parameter private java.util.List<java.lang.String> expectedProvidedScopeExclusions
List ofgroupId:artifactIdstrings of artifact coordinates that are to be excluded from "expected provided scope" check. Default value:["org.apache.maven:maven-archiver", "org.apache.maven:maven-jxr"].- Since:
- 3.6.3
-
LS
private static final java.lang.String LS
System/OS line separator: used to format console messages.
-
-
Method Detail
-
getOutputDirectory
protected abstract java.io.File getOutputDirectory()
- Returns:
- the output directory where files will be generated.
-
createGenerator
protected abstract Generator createGenerator()
- Returns:
- the wanted
Generatorimplementation.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDefaultGoalPrefix
static java.lang.String getDefaultGoalPrefix(org.apache.maven.project.MavenProject project)
-
dependenciesNotInProvidedScope
private java.util.Set<org.apache.maven.artifact.Artifact> dependenciesNotInProvidedScope()
Collects all dependencies expected to be in "provided" scope but are NOT in "provided" scope.
-
filterMojoDependencies
private java.util.Set<org.apache.maven.artifact.Artifact> filterMojoDependencies()
Get dependencies filtered with mojoDependencies configuration.- Returns:
- eventually filtered dependencies, or even
nullif configured with empty mojoDependencies list - See Also:
mojoDependencies
-
-