Klasse CheckMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
com.github.koraktor.mavanagaiata.mojo.CheckMojo
- Alle implementierten Schnittstellen:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="check",
defaultPhase=VALIDATE,
threadSafe=true)
public class CheckMojo
extends AbstractGitMojo
This goal checks various aspects of a Git repository to ensure it is in a
valid state prior to a build
The following checks are available:
- Clean working directory (enabled by default)
- Tagged commit
- Branch name
- Commit message
- Seit:
- 0.8.0
- Autor:
- Sebastian Staudt
-
Feldübersicht
Modifizierer und TypFeldBeschreibung(Package privat) String
Check whether the current branch is the given branch(Package privat) boolean
Check if the working directory is clean(Package privat) String
Check whether the message of the current commit matches the given format(Package privat) boolean
Check whether the current commit is tagged(Package privat) Pattern
Von Klasse geerbte Felder com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
baseDir, dateFormat, dirtyFlag, dirtyIgnoreUntracked, failGracefully, gitDir, head, project, propertyPrefixes, skip, skipNoGit
Von Schnittstelle geerbte Felder org.apache.maven.plugin.Mojo
ROLE
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate void
checkBranch
(GitRepository repository) Checks if the branch matches the configured nameprivate void
checkClean
(GitRepository repository) Checks if the worktree is in a clean stateprivate void
checkCommitMessage
(GitRepository repository) Checks if commit message matches the configured patternprivate void
checkTag
(GitRepository repository) Checks if the the currentHEAD
is taggedprotected GitRepository
init()
Generic initialization for all Mavanagaiata mojos(Package privat) void
Compiles the commit message check regexprotected void
run
(GitRepository repository) The actual implementation of the mojoVon Klasse geerbte Methoden com.github.koraktor.mavanagaiata.mojo.AbstractGitMojo
addProperty, execute, initRepository, prepareParameters
Von Klasse geerbte Methoden org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Felddetails
-
commitMessagePattern
Pattern commitMessagePattern -
checkBranch
Check whether the current branch is the given branch -
checkClean
@Parameter(property="mavanagaiata.checkClean", defaultValue="true") boolean checkCleanCheck if the working directory is clean -
checkCommitMessage
Check whether the message of the current commit matches the given format -
checkTag
@Parameter(property="mavanagaiata.checkTag", defaultValue="false") boolean checkTagCheck whether the current commit is tagged
-
-
Konstruktordetails
-
CheckMojo
public CheckMojo()
-
-
Methodendetails
-
init
Beschreibung aus Klasse kopiert:AbstractGitMojo
Generic initialization for all Mavanagaiata mojosThis will initialize the JGit repository instance for further usage by the mojo.
- Setzt außer Kraft:
init
in KlasseAbstractGitMojo
- Gibt zurück:
false
if the execution should be skipped- Löst aus:
MavanagaiataMojoException
- if the repository cannot be initialized
-
initConfiguration
void initConfiguration()Compiles the commit message check regex -
run
Beschreibung aus Klasse kopiert:AbstractGitMojo
The actual implementation of the mojo- Angegeben von:
run
in KlasseAbstractGitMojo
- Parameter:
repository
- The repository instance to use- Löst aus:
MavanagaiataMojoException
- if there is an error during execution
-
checkBranch
private void checkBranch(GitRepository repository) throws CheckMojoException, GitRepositoryException Checks if the branch matches the configured name- Parameter:
repository
- The repository instance to check- Löst aus:
CheckMojoException
- if the branch does not matchGitRepositoryException
- if the current branch cannot be retrieved- Siehe auch:
-
checkClean
Checks if the worktree is in a clean state- Parameter:
repository
- The repository instance to check- Löst aus:
CheckMojoException
- if the worktree is not cleanGitRepositoryException
- if the worktree state cannot be retrieved- Siehe auch:
-
checkCommitMessage
private void checkCommitMessage(GitRepository repository) throws GitRepositoryException, CheckMojoException Checks if commit message matches the configured pattern- Parameter:
repository
- The repository instance to check- Löst aus:
CheckMojoException
- if the commit message does not matchGitRepositoryException
- if the current commit cannot be retrieved- Siehe auch:
-
checkTag
Checks if the the currentHEAD
is tagged- Parameter:
repository
- The repository instance to check- Löst aus:
CheckMojoException
- ifHEAD
is not taggedGitRepositoryException
- if the commit cannot be described- Siehe auch:
-