Class TagMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.github.koraktor.mavanagaiata.mojo.TagMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="tag",
defaultPhase=INITIALIZE,
threadSafe=true)
public class TagMojo
extends org.apache.maven.plugin.AbstractMojo
This goal provides the most recent Git tag in the "mavanagaiata.tag" and
"mvngit.tag" properties.
This goal provides the most recent Git tag name in the
"mavanagaiata.tag.name" and "mvngit.tag.name" properties. Additionally,
more exact information as per
git describe
is provided in the
"mavanagaiata.tag.describe" and "mvngit.tag.describe" properties- Since:
- 0.1.0
- Author:
- Sebastian Staudt
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The date format to use for various datesprotected org.apache.maven.project.MavenProject
The Maven projectFields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
execute()
Generic execution sequence for a Mavanagaiata mojoprotected GitRepository
init()
Generic initialization for all Mavanagaiata mojosvoid
run
(GitRepository repository) This will first read all tags and walk the commit hierarchy down from HEAD until it finds one of the tags.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
dateFormat
@Parameter(property="mavanagaiata.dateFormat", defaultValue="MM/dd/yyyy hh:mm a Z") protected String dateFormatThe date format to use for various dates -
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject projectThe Maven project
-
-
Constructor Details
-
TagMojo
public TagMojo()
-
-
Method Details
-
run
public void run(GitRepository repository) throws com.github.koraktor.mavanagaiata.mojo.MavanagaiataMojoException This will first read all tags and walk the commit hierarchy down from HEAD until it finds one of the tags. The name of that tag is written into "mavanagaiata.tag.name" and "mvngit.tag.name" respectively.A more canonical representation as per
git describe
is stored in "mavanagaiata.tag.describe" and "mvngit.tag.describe".- Parameters:
repository
- The repository instance to use- Throws:
com.github.koraktor.mavanagaiata.mojo.MavanagaiataMojoException
- if the tags cannot be read
-
execute
public final void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionGeneric execution sequence for a Mavanagaiata mojoWill initialize any needed resources, run the actual mojo code and cleanup afterwards.
- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the mojo execution fails andfailGracefully
isfalse
org.apache.maven.plugin.MojoFailureException
- if the mojo execution fails andfailGracefully
istrue
- See Also:
-
init
protected GitRepository init() throws com.github.koraktor.mavanagaiata.mojo.MavanagaiataMojoExceptionGeneric initialization for all Mavanagaiata mojosThis will initialize the JGit repository instance for further usage by the mojo.
- Returns:
false
if the execution should be skipped- Throws:
com.github.koraktor.mavanagaiata.mojo.MavanagaiataMojoException
- if the repository cannot be initialized
-