public abstract class AbstractGitFlowMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected CommitMessages |
commitMessages
Git commit messages.
|
protected boolean |
fetchRemote
Whether to fetch remote branch and compare it with the local one.
|
protected GitFlowConfig |
gitFlowConfig
Git flow configuration.
|
protected boolean |
installProject
Whether to call Maven install goal during the mojo execution.
|
protected static String |
LS
System line separator.
|
protected org.apache.maven.execution.MavenSession |
mavenSession
Maven session.
|
protected org.codehaus.plexus.components.interactivity.Prompter |
prompter
Default prompter.
|
protected org.apache.maven.settings.Settings |
settings
Maven settings.
|
protected boolean |
tychoBuild
Whether this is Tycho build.
|
| Constructor and Description |
|---|
AbstractGitFlowMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkSnapshotDependencies() |
protected void |
checkUncommittedChanges()
Checks uncommitted changes.
|
protected String |
getCurrentProjectVersion()
Gets current project version evaluating pom.xml
This implementation takes care of version based on properties or other runtime evaluation needed.
|
protected void |
gitBranchDelete(String branchName)
Executes git branch -d.
|
protected void |
gitBranchDeleteForce(String branchName)
Executes git branch -D.
|
protected boolean |
gitCheckBranchExists(String branchName)
Checks if local branch with given name exists.
|
protected void |
gitCheckout(String branchName)
Executes git checkout.
|
protected boolean |
gitCheckTagExists(String tagName)
Checks if local tag with given name exists.
|
protected void |
gitCommit(String message)
Executes git commit -a -m.
|
protected void |
gitCommit(String message,
Map<String,String> messageProperties)
Executes git commit -a -m, replacing
@{map.key} with
map.value. |
protected void |
gitCreateAndCheckout(String newBranchName,
String fromBranchName)
Executes git checkout -b.
|
protected void |
gitCreateBranch(String newBranchName,
String fromBranchName)
Executes git branch.
|
protected void |
gitFetchRemoteAndCompare(String branchName)
Executes git fetch and compares local branch with the remote.
|
protected void |
gitFetchRemoteAndCreate(String branchName)
Fetches and checkouts from remote if local branch doesn't exist.
|
protected String |
gitFindBranches(String branchName,
boolean firstMatch)
Executes git for-each-ref with
refname:short format. |
protected String |
gitFindLastTag()
Executes git for-each-ref to get the last tag.
|
protected String |
gitFindTags()
Executes git for-each-ref to get all tags.
|
protected void |
gitMerge(String branchName,
boolean rebase,
boolean noff,
boolean ffonly,
String message,
Map<String,String> messageProperties)
Executes git rebase or git merge --ff-only or git merge --no-ff or git merge.
|
protected void |
gitMergeNoff(String branchName)
Executes git merge --no-ff.
|
protected void |
gitMergeSquash(String branchName)
Executes git merge --squash.
|
protected void |
gitPush(String branchName,
boolean pushTags)
Executes git push, optionally with the
--follow-tags
argument. |
protected void |
gitPushDelete(String branchName) |
protected void |
gitTag(String tagName,
String message,
boolean gpgSignTag,
Map<String,String> messageProperties)
Executes git tag -a [-s] -m.
|
protected void |
initGitFlowConfig()
Executes git config commands to set Git Flow configuration.
|
protected void |
mvnCleanInstall()
Executes mvn clean install.
|
protected void |
mvnCleanTest()
Executes mvn clean test.
|
protected void |
mvnRun(String goals)
Executes Maven goals.
|
protected void |
mvnSetVersions(String version)
Executes 'set' goal of versions-maven-plugin or 'set-version' of
tycho-versions-plugin in case it is tycho build.
|
protected boolean |
notSameProdDevName()
Compares the production branch name with the development branch name.
|
void |
setArgLine(String argLine) |
protected void |
validateConfiguration(String... params)
Validates plugin configuration.
|
protected boolean |
validBranchName(String branchName)
Checks if branch name is acceptable.
|
getLog, getPluginContext, setLog, setPluginContextprotected static final String LS
@Parameter(defaultValue="${gitFlowConfig}")
protected GitFlowConfig gitFlowConfig
@Parameter(defaultValue="${commitMessages}")
protected CommitMessages commitMessages
@Parameter(defaultValue="false") protected boolean tychoBuild
@Parameter(property="installProject",
defaultValue="false")
protected boolean installProject
@Parameter(property="fetchRemote",
defaultValue="true")
protected boolean fetchRemote
@Parameter(defaultValue="${session}",
readonly=true)
protected org.apache.maven.execution.MavenSession mavenSession
@Component protected org.codehaus.plexus.components.interactivity.Prompter prompter
@Parameter(defaultValue="${settings}",
readonly=true)
protected org.apache.maven.settings.Settings settings
protected void validateConfiguration(String... params) throws org.apache.maven.plugin.MojoFailureException
params - Configuration parameters to validate.org.apache.maven.plugin.MojoFailureException - If configuration is not valid.protected String getCurrentProjectVersion() throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected boolean notSameProdDevName()
true if the production branch name is different from
the development branch name, false otherwise.protected void checkUncommittedChanges()
throws org.apache.maven.plugin.MojoFailureException,
org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void checkSnapshotDependencies()
throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureExceptionprotected boolean validBranchName(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to check.true when name is valid, false
otherwise.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void initGitFlowConfig()
throws org.apache.maven.plugin.MojoFailureException,
org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected String gitFindBranches(String branchName, boolean firstMatch) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
refname:short format.branchName - Branch name to find.firstMatch - Return first match.refs/heads/{branchName}*.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected String gitFindTags() throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected String gitFindLastTag() throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected boolean gitCheckBranchExists(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Name of the branch to check.true if local branch exists, false
otherwise.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected boolean gitCheckTagExists(String tagName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
tagName - Name of the tag to check.true if local tag exists, false otherwise.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitCheckout(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to checkout.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitCreateAndCheckout(String newBranchName, String fromBranchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
newBranchName - Create branch with this name.fromBranchName - Create branch from this branch.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitCreateBranch(String newBranchName, String fromBranchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
newBranchName - Create branch with this name.fromBranchName - Create branch from this branch.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitCommit(String message) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
message - Commit message.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitCommit(String message, Map<String,String> messageProperties) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
@{map.key} with
map.value.message - Commit message.messageProperties - Properties to replace in message.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitMerge(String branchName, boolean rebase, boolean noff, boolean ffonly, String message, Map<String,String> messageProperties) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to merge.rebase - Do rebase.noff - Merge with --no-ff.ffonly - Merge with --ff-only.message - Merge commit message.messageProperties - Properties to replace in message.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitMergeNoff(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to merge.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitMergeSquash(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to merge.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitTag(String tagName, String message, boolean gpgSignTag, Map<String,String> messageProperties) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
tagName - Name of the tag.message - Tag message.gpgSignTag - Make a GPG-signed tag.messageProperties - Properties to replace in message.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitBranchDelete(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to delete.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitBranchDeleteForce(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to delete.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitFetchRemoteAndCreate(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to check.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitFetchRemoteAndCompare(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
branchName - Branch name to fetch and compare.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitPush(String branchName, boolean pushTags) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
--follow-tags
argument.branchName - Branch name to push.pushTags - If true adds --follow-tags argument
to the git push command.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void gitPushDelete(String branchName) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void mvnSetVersions(String version) throws org.apache.maven.plugin.MojoFailureException, org.codehaus.plexus.util.cli.CommandLineException
version - New version to set.org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void mvnCleanTest()
throws org.apache.maven.plugin.MojoFailureException,
org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void mvnCleanInstall()
throws org.apache.maven.plugin.MojoFailureException,
org.codehaus.plexus.util.cli.CommandLineException
org.apache.maven.plugin.MojoFailureExceptionorg.codehaus.plexus.util.cli.CommandLineExceptionprotected void mvnRun(String goals) throws Exception
goals - The goals to execute.Exceptionpublic void setArgLine(String argLine)
Copyright © 2014–2019. All rights reserved.