public abstract class MojoSupport
extends org.apache.maven.plugin.AbstractMojo
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Modifier and Type | Field and Description |
---|---|
protected org.codehaus.plexus.PlexusContainer |
container |
protected org.apache.maven.plugin.logging.Log |
log
Instance logger.
|
Modifier | Constructor and Description |
---|---|
protected |
MojoSupport() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
protected org.apache.maven.artifact.Artifact |
createArtifact(ArtifactItem item)
Create a new artifact.
|
protected void |
doExecute()
Sub-class should override to provide custom execution logic.
|
void |
execute()
Main Mojo execution hook.
|
protected org.apache.maven.artifact.Artifact |
getArtifact(ArtifactItem item)
Resolves the Artifact from the remote repository if nessessary.
|
protected org.apache.maven.artifact.factory.ArtifactFactory |
getArtifactFactory()
Get the artifact factory.
|
protected org.apache.maven.artifact.repository.ArtifactRepository |
getArtifactRepository()
Get the artifact repository.
|
protected org.apache.maven.artifact.resolver.ArtifactResolver |
getArtifactResolver()
Get the artifact resolver.
|
protected org.apache.maven.project.MavenProject |
getProject()
Get the Maven project.
|
protected Set |
getProjectArtifacts() |
protected Set |
getProjectArtifacts(boolean resolve) |
protected Set |
getProjectArtifacts(org.apache.maven.project.MavenProject project,
boolean resolve) |
protected void |
init()
Initializes logging.
|
protected org.apache.maven.artifact.Artifact |
resolveArtifact(org.apache.maven.artifact.Artifact artifact)
Resolves the Artifact from the remote repository non-transitivly.
|
protected org.apache.maven.artifact.Artifact |
resolveArtifact(org.apache.maven.artifact.Artifact artifact,
boolean transitive)
Resolves the Artifact from the remote repository if nessessary.
|
protected org.codehaus.plexus.PlexusContainer container
protected org.apache.maven.plugin.logging.Log log
AbstractMojo.getLog()
on execution.protected void init() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
execute()
.org.apache.maven.plugin.MojoExecutionException
- Initialization failedorg.apache.maven.plugin.MojoFailureException
- Initialization failedpublic void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException
contextualize
in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
org.codehaus.plexus.context.ContextException
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
doExecute()
instead.execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected void doExecute() throws Exception
Exception
- Execution failedprotected org.apache.maven.project.MavenProject getProject()
Sub-class must overridde to provide access.
protected org.apache.maven.artifact.repository.ArtifactRepository getArtifactRepository()
Sub-class must overridde to provide access.
protected final org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
protected final org.apache.maven.artifact.resolver.ArtifactResolver getArtifactResolver()
protected org.apache.maven.artifact.Artifact createArtifact(ArtifactItem item) throws org.apache.maven.plugin.MojoExecutionException
item
- The item to create an artifact fororg.apache.maven.plugin.MojoExecutionException
- Failed to create artifactprotected org.apache.maven.artifact.Artifact getArtifact(ArtifactItem item) throws org.apache.maven.plugin.MojoExecutionException
item
- The item to create an artifact for; must not be nullorg.apache.maven.plugin.MojoExecutionException
- Failed to create artifactprotected org.apache.maven.artifact.Artifact resolveArtifact(org.apache.maven.artifact.Artifact artifact, boolean transitive) throws org.apache.maven.plugin.MojoExecutionException
artifact
- The artifact to be resolved; must not be nulltransitive
- True to resolve the artifact transitivlyorg.apache.maven.plugin.MojoExecutionException
- Failed to resolve artifactprotected org.apache.maven.artifact.Artifact resolveArtifact(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
artifact
- The artifact to be resolved; must not be nullorg.apache.maven.plugin.MojoExecutionException
- Failed to resolve artifactresolveArtifact(Artifact,boolean)
protected Set getProjectArtifacts(org.apache.maven.project.MavenProject project, boolean resolve) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Set getProjectArtifacts(boolean resolve) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Set getProjectArtifacts() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
Copyright © 2012 Codehaus. All Rights Reserved.