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.AbstractMojo
Abstract class for this Plugin.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.sonatype.plexus.build.incremental.BuildContext
private boolean
Flag controlling is "expected dependencies in provided scope" check to be performed or not.protected String
The file encoding of the source files.List ofgroupId:artifactId
strings of artifact coordinates that are to be excluded from "expected provided scope" check.List ofgroupId
strings of artifact coordinates that are expected to be in "provided" scope.The role names of mojo extractors to use.protected String
The goal prefix that will appear before the ":".protected org.apache.maven.artifact.repository.ArtifactRepository
Location of the local repository.private static final String
System/OS line separator: used to format console messages.Specify the dependencies asgroupId:artifactId
containing (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis.protected MojoScanner
The component used for scanning the source tree for mojos.Maven plugin packaging types.protected org.apache.maven.project.MavenProject
The project currently being built.protected List<org.apache.maven.artifact.repository.ArtifactRepository>
List of Remote Repositories used by the resolverprotected boolean
Set this to "true" to skip invoking any goals or reports of the plugin.protected boolean
By default an exception is throw if no mojo descriptor is found.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Generator
private Set<org.apache.maven.artifact.Artifact>
Collects all dependencies expected to be in "provided" scope but are NOT in "provided" scope.void
execute()
private Set<org.apache.maven.artifact.Artifact>
Get dependencies filtered with mojoDependencies configuration.(package private) static String
getDefaultGoalPrefix
(org.apache.maven.project.MavenProject project) protected abstract File
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject projectThe project currently being built. -
mojoScanner
The component used for scanning the source tree for mojos. -
buildContext
-
encoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") protected String encodingThe file encoding of the source files.- Since:
- 2.5
-
goalPrefix
The goal prefix that will appear before the ":". -
skipErrorNoDescriptorsFound
@Parameter(property="maven.plugin.skipErrorNoDescriptorsFound", defaultValue="false") protected boolean skipErrorNoDescriptorsFoundBy 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
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
Set this to "true" to skip invoking any goals or reports of the plugin.- Since:
- 2.8
-
mojoDependencies
Specify the dependencies asgroupId:artifactId
containing (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis. By default, the value isnull
and 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 List<org.apache.maven.artifact.repository.ArtifactRepository> remoteReposList 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 localLocation of the local repository.- Since:
- 3.0
-
packagingTypes
Maven plugin packaging types. Default is single "maven-plugin".- Since:
- 3.3
-
checkExpectedProvidedScope
@Parameter(defaultValue="true", property="maven.plugin.checkExpectedProvidedScope") private boolean checkExpectedProvidedScopeFlag controlling is "expected dependencies in provided scope" check to be performed or not. Default value:true
.- Since:
- 3.6.3
-
expectedProvidedScopeGroupIds
List ofgroupId
strings of artifact coordinates that are expected to be in "provided" scope. Default value:["org.apache.maven"]
.- Since:
- 3.6.3
-
expectedProvidedScopeExclusions
List ofgroupId:artifactId
strings 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
System/OS line separator: used to format console messages.
-
-
Constructor Details
-
AbstractGeneratorMojo
public AbstractGeneratorMojo()
-
-
Method Details
-
getOutputDirectory
- Returns:
- the output directory where files will be generated.
-
createGenerator
- Returns:
- the wanted
Generator
implementation.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDefaultGoalPrefix
-
dependenciesNotInProvidedScope
Collects all dependencies expected to be in "provided" scope but are NOT in "provided" scope. -
filterMojoDependencies
Get dependencies filtered with mojoDependencies configuration.- Returns:
- eventually filtered dependencies, or even
null
if configured with empty mojoDependencies list - See Also:
-