diff --git a/README.md b/README.md
index 14591e43..12e6779d 100644
--- a/README.md
+++ b/README.md
@@ -356,6 +356,16 @@ E.g. `mvn gitflow:release-finish -DpostReleaseGoals=deploy` will run `mvn deploy
The `gitflow:hotfix-finish` goal has `preHotfixGoals` and `postHotfixGoals` parameters which can be used to run defined Maven goals before and after the hotfix respectively.
+### Activating custom Maven profiles
+
+The `profiles` parameter is avaliable for all maven commands executed.
+
+The `mvn gitflow:feature-finish` goal has `preFeatureFinishProfiles` and `postFeatureFinishProfiles` parameters, which will be activated for the corresponding goals.
+
+The `mvn gitflow:hotfix-finish` goal has `preHotfixProfiles` and `postHotfixProfiles` parameters, which will be activated for the corresponding goals.
+
+The `mvn gitflow:release-finish` and `mvn gitflow:release` goal both have `preReleaseProfiles` and `postReleaseProfiles` parameters, which will be activated for the corresponding goals.
+
# Non-interactive Mode
Maven can be run in non-interactive (batch) mode. By using non-interactive mode goals can be run in continuous integration environment.
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
index 835aa49e..36b6f844 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
@@ -49,9 +49,11 @@
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
+import static java.util.Arrays.asList;
+
/**
* Abstract git flow mojo.
- *
+ *
*/
public abstract class AbstractGitFlowMojo extends AbstractMojo {
/** Group and artifact id of the versions-maven-plugin. */
@@ -93,7 +95,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Git commit messages.
- *
+ *
* @since 1.2.1
*/
@Parameter(defaultValue = "${commitMessages}")
@@ -101,15 +103,15 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether this is Tycho build.
- *
+ *
* @since 1.1.0
*/
@Parameter(defaultValue = "false")
protected boolean tychoBuild;
-
+
/**
* Whether to call Maven install goal during the mojo execution.
- *
+ *
* @since 1.0.5
*/
@Parameter(property = "installProject", defaultValue = "false")
@@ -117,7 +119,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether to fetch remote branch and compare it with the local one.
- *
+ *
* @since 1.3.0
*/
@Parameter(property = "fetchRemote", defaultValue = "true")
@@ -125,7 +127,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether to print commands output into the console.
- *
+ *
* @since 1.0.7
*/
@Parameter(property = "verbose", defaultValue = "false")
@@ -133,7 +135,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Command line arguments to pass to the underlying Maven commands.
- *
+ *
* @since 1.8.0
*/
@Parameter(property = "argLine")
@@ -141,7 +143,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether to make a GPG-signed commit.
- *
+ *
* @since 1.9.0
*/
@Parameter(property = "gpgSignCommit", defaultValue = "false")
@@ -150,7 +152,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether to set -DgroupId='*' -DartifactId='*' when calling
* versions-maven-plugin.
- *
+ *
* @since 1.10.0
*/
@Parameter(property = "versionsForceUpdate", defaultValue = "false")
@@ -167,7 +169,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Whether to skip updating version. Useful with {@link #versionProperty} to be
* able to update revision
property without modifying version tag.
- *
+ *
* @since 1.13.0
*/
@Parameter(property = "skipUpdateVersion")
@@ -175,7 +177,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Prefix that is applied to commit messages.
- *
+ *
* @since 1.14.0
*/
@Parameter(property = "commitMessagePrefix")
@@ -204,7 +206,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Version of versions-maven-plugin to use.
- *
+ *
* @since 1.18.0
*/
@Parameter(property = "versionsMavenPluginVersion", defaultValue = "2.8.1")
@@ -212,7 +214,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
/**
* Version of tycho-versions-plugin to use.
- *
+ *
* @since 1.18.0
*/
@Parameter(property = "tychoVersionsPluginVersion", defaultValue = "0.24.0")
@@ -223,7 +225,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
* Multiple options can be added separated with a space e.g.
* -DgitPushOptions="merge_request.create merge_request.target=develop
* merge_request.label='Super feature'"
- *
+ *
* @since 1.18.0
*/
@Parameter(property = "gitPushOptions")
@@ -233,7 +235,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
* Explicitly enable or disable executing Git submodule update before commit. By
* default plugin tries to automatically determine if update of the Git
* submodules is needed.
- *
+ *
* @since 1.19.0
*/
@Parameter(property = "updateGitSubmodules")
@@ -256,7 +258,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
@Component
protected ProjectBuilder projectBuilder;
-
+
/** Default prompter. */
@Component
protected Prompter prompter;
@@ -271,9 +273,17 @@ public AbstractGitFlowMojo() {
gitModulesExists = FileUtils.fileExists(".gitmodules");
}
+ /**
+ * Maven profiles to activate for every maven goal.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "profiles")
+ private String profiles;
+
/**
* Initializes command line executables.
- *
+ *
*/
private void initExecutables() {
if (StringUtils.isBlank(cmdMvn.getExecutable())) {
@@ -300,7 +310,7 @@ private void initExecutables() {
/**
* Validates plugin configuration. Throws exception if configuration is not
* valid.
- *
+ *
* @param params
* Configuration parameters to validate.
* @throws MojoFailureException
@@ -326,7 +336,7 @@ protected void validateConfiguration(String... params)
/**
* Gets current project version from pom.xml file.
- *
+ *
* @return Current project version.
* @throws MojoFailureException
* If current project version cannot be obtained.
@@ -343,7 +353,7 @@ protected String getCurrentProjectVersion() throws MojoFailureException {
/**
* Gets current project {@link #REPRODUCIBLE_BUILDS_PROPERTY} property value
* from pom.xml file.
- *
+ *
* @return Value of {@link #REPRODUCIBLE_BUILDS_PROPERTY} property.
* @throws MojoFailureException
* If project loading fails.
@@ -355,7 +365,7 @@ private String getCurrentProjectOutputTimestamp() throws MojoFailureException {
/**
* Reloads projects info from file.
- *
+ *
* @param project
* @return Reloaded Maven projects.
* @throws MojoFailureException
@@ -380,7 +390,7 @@ private List reloadProjects(final MavenProject project) throws Moj
/**
* Reloads project info from file.
- *
+ *
* @param project
* @return Maven project which is the execution root.
* @throws MojoFailureException
@@ -399,7 +409,7 @@ private MavenProject reloadProject(final MavenProject project) throws MojoFailur
/**
* Compares the production branch name with the development branch name.
- *
+ *
* @return true
if the production branch name is different from
* the development branch name, false
otherwise.
*/
@@ -410,7 +420,7 @@ protected boolean notSameProdDevName() {
/**
* Checks uncommitted changes.
- *
+ *
* @throws MojoFailureException
* If there is some uncommitted files.
* @throws CommandLineException
@@ -465,7 +475,7 @@ protected void checkSnapshotDependencies() throws MojoFailureException {
/**
* Checks if branch name is acceptable.
- *
+ *
* @param branchName
* Branch name to check.
* @return true
when name is valid, false
otherwise.
@@ -482,7 +492,7 @@ protected boolean validBranchName(final String branchName)
/**
* Executes git commands to check for uncommitted changes.
- *
+ *
* @return true
when there are uncommitted changes,
* false
otherwise.
* @throws CommandLineException
@@ -524,7 +534,7 @@ private boolean executeGitHasUncommitted() throws MojoFailureException,
/**
* Executes git config commands to set Git Flow configuration.
- *
+ *
* @throws MojoFailureException
* Shouldn't happen, actually.
* @throws CommandLineException
@@ -546,7 +556,7 @@ protected void initGitFlowConfig() throws MojoFailureException,
/**
* Executes git config command.
- *
+ *
* @param name
* Option name.
* @param value
@@ -568,7 +578,7 @@ private void gitSetConfig(final String name, String value)
/**
* Executes git for-each-ref with refname:short
format.
- *
+ *
* @param branchName
* Branch name to find.
* @param firstMatch
@@ -586,7 +596,7 @@ protected String gitFindBranches(final String branchName, final boolean firstMat
/**
* Executes git for-each-ref with refname:short
format.
- *
+ *
* @param refs
* Refs to search.
* @param branchName
@@ -662,7 +672,7 @@ protected String gitFindLastTag() throws MojoFailureException, CommandLineExcept
/**
* Removes double quotes from the string.
- *
+ *
* @param str
* String to remove quotes from.
* @return String without quotes.
@@ -673,7 +683,7 @@ private String removeQuotes(String str) {
/**
* Gets the current branch name.
- *
+ *
* @return Current branch name.
* @throws MojoFailureException
* If command line execution returns false code.
@@ -780,7 +790,7 @@ protected void gitCreateBranch(final String newBranchName, final String fromBran
/**
* Replaces properties in message.
- *
+ *
* @param message
* @param map
* Key is a string to replace wrapped in @{...}
. Value
@@ -798,7 +808,7 @@ private String replaceProperties(String message, Map map) {
/**
* Executes git commit -a -m.
- *
+ *
* @param message
* Commit message.
* @throws MojoFailureException
@@ -813,7 +823,7 @@ protected void gitCommit(final String message) throws MojoFailureException, Comm
/**
* Executes git commit -a -m, replacing @{map.key}
with
* map.value
.
- *
+ *
* @param message
* Commit message.
* @param messageProperties
@@ -849,7 +859,7 @@ protected void gitCommit(String message, Map messageProperties)
/**
* Executes git rebase or git merge --ff-only or git merge --no-ff or git merge.
- *
+ *
* @param branchName
* Branch name to merge.
* @param rebase
@@ -901,7 +911,7 @@ protected void gitMerge(final String branchName, boolean rebase, boolean noff, b
/**
* Executes git merge --no-ff.
- *
+ *
* @param branchName
* Branch name to merge.
* @param message
@@ -921,7 +931,7 @@ protected void gitMergeNoff(final String branchName, final String message,
/**
* Executes git merge --squash.
- *
+ *
* @param branchName
* Branch name to merge.
* @throws MojoFailureException
@@ -937,7 +947,7 @@ protected void gitMergeSquash(final String branchName)
/**
* Executes git tag -a [-s] -m.
- *
+ *
* @param tagName
* Name of the tag.
* @param message
@@ -968,7 +978,7 @@ protected void gitTag(final String tagName, String message, boolean gpgSignTag,
/**
* Executes git branch -d.
- *
+ *
* @param branchName
* Branch name to delete.
* @throws MojoFailureException
@@ -985,7 +995,7 @@ protected void gitBranchDelete(final String branchName)
/**
* Executes git branch -D.
- *
+ *
* @param branchName
* Branch name to delete.
* @throws MojoFailureException
@@ -1003,7 +1013,7 @@ protected void gitBranchDeleteForce(final String branchName)
/**
* Executes git fetch and checks if local branch exists. If local branch is
* present then compares it with the remote, if not then branch is checked out.
- *
+ *
* @param branchName
* Branch name to check.
* @throws MojoFailureException
@@ -1036,7 +1046,7 @@ protected void gitFetchRemoteAndCompareCreate(final String branchName) throws Mo
/**
* Executes git fetch and git for-each-ref with refname:short
* format. Searches refs/remotes/{gitFlowConfig#origin}/
.
- *
+ *
* @param branchName
* Branch name to find.
* @param firstMatch
@@ -1056,7 +1066,7 @@ protected String gitFetchAndFindRemoteBranches(final String branchName, final bo
/**
* Executes git fetch.
- *
+ *
* @return true
if git fetch returned success exit code,
* false
otherwise.
* @throws MojoFailureException
@@ -1082,7 +1092,7 @@ private boolean gitFetchRemote() throws MojoFailureException, CommandLineExcepti
/**
* Executes git push, optionally with the --follow-tags
argument.
- *
+ *
* @param branchName
* Branch name to push.
* @param pushTags
@@ -1139,7 +1149,7 @@ protected void gitPushDelete(final String branchName)
/**
* Executes 'set' goal of versions-maven-plugin or 'set-version' of
* tycho-versions-plugin in case it is tycho build.
- *
+ *
* @param version
* New version to set.
* @throws MojoFailureException
@@ -1216,7 +1226,7 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
/**
* Executes mvn clean test.
- *
+ *
* @throws MojoFailureException
* If command line execution returns false code.
* @throws CommandLineException
@@ -1234,7 +1244,7 @@ protected void mvnCleanTest() throws MojoFailureException,
/**
* Executes mvn clean install.
- *
+ *
* @throws MojoFailureException
* If command line execution returns false code.
* @throws CommandLineException
@@ -1248,22 +1258,30 @@ protected void mvnCleanInstall() throws MojoFailureException,
}
/**
- * Executes Maven goals.
- *
+ * Executes Maven goals, with activated profiles.
+ *
* @param goals
* The goals to execute.
+ * @param profiles
+ * The profiles to activate.
* @throws Exception
* If command line parsing or execution fails.
*/
- protected void mvnRun(final String goals) throws Exception {
- getLog().info("Running Maven goals: " + goals);
+ protected void mvnRun(final String goals, final String profiles) throws Exception {
+ getLog().info("Running Maven goals: " + goals + ", profiles: " + profiles);
+
+ final List args = asList(CommandLineUtils.translateCommandline(goals));
- executeMvnCommand(CommandLineUtils.translateCommandline(goals));
+ if (StringUtils.isNotBlank(profiles)) {
+ args.add("-P" + profiles);
+ }
+
+ executeMvnCommand(args.toArray(new String[args.size()]));
}
/**
* Executes Git command and returns output.
- *
+ *
* @param args
* Git command line arguments.
* @return Command output.
@@ -1279,7 +1297,7 @@ private String executeGitCommandReturn(final String... args)
/**
* Executes Git command without failing on non successful exit code.
- *
+ *
* @param args
* Git command line arguments.
* @return Command result.
@@ -1295,7 +1313,7 @@ private CommandResult executeGitCommandExitCode(final String... args)
/**
* Executes Git command.
- *
+ *
* @param args
* Git command line arguments.
* @throws CommandLineException
@@ -1310,7 +1328,7 @@ private void executeGitCommand(final String... args)
/**
* Executes Maven command.
- *
+ *
* @param args
* Maven command line arguments.
* @throws CommandLineException
@@ -1320,12 +1338,16 @@ private void executeGitCommand(final String... args)
*/
private void executeMvnCommand(final String... args)
throws CommandLineException, MojoFailureException {
- executeCommand(cmdMvn, true, argLine, args);
+ final List localArgs = asList(args);
+ if (StringUtils.isNotBlank(profiles)) {
+ localArgs.add("-P" + profiles);
+ }
+ executeCommand(cmdMvn, true, argLine, localArgs.toArray(new String[localArgs.size()]));
}
/**
* Executes command line.
- *
+ *
* @param cmd
* Command line.
* @param failOnError
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureFinishMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureFinishMojo.java
index 1376431c..7545b660 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureFinishMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureFinishMojo.java
@@ -30,7 +30,7 @@
/**
* The git flow feature finish mojo.
- *
+ *
*/
@Mojo(name = "feature-finish", aggregator = true)
public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
@@ -41,7 +41,7 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
/**
* Whether to skip calling Maven test goal before merging the branch.
- *
+ *
* @since 1.0.5
*/
@Parameter(property = "skipTestProject", defaultValue = "false")
@@ -50,7 +50,7 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
/**
* Whether to squash feature branch commits into a single commit upon
* merging.
- *
+ *
* @since 1.2.3
*/
@Parameter(property = "featureSquash", defaultValue = "false")
@@ -58,7 +58,7 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
/**
* Whether to push to the remote.
- *
+ *
* @since 1.3.0
*/
@Parameter(property = "pushRemote", defaultValue = "true")
@@ -66,7 +66,7 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
/**
* Feature name, without feature branch prefix, to use in non-interactive mode.
- *
+ *
* @since 1.9.0
*/
@Parameter(property = "featureName")
@@ -76,7 +76,7 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
* Feature branch to use in non-interactive mode. Must start with feature branch
* prefix. The featureBranch parameter will be used instead of
* {@link #featureName} if both are set.
- *
+ *
* @since 1.16.0
*/
@Parameter(property = "featureBranch")
@@ -91,6 +91,15 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "preFeatureFinishGoals")
private String preFeatureFinishGoals;
+ /**
+ * Maven profiles to activate in the feature branch before merging into the
+ * development branch.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "preFeatureFinishProfiles")
+ private String preFeatureFinishProfiles;
+
/**
* Maven goals to execute in the development branch after merging a feature.
*
@@ -99,6 +108,14 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "postFeatureFinishGoals")
private String postFeatureFinishGoals;
+ /**
+ * Maven profiles to activate in the development branch after merging a feature.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "postFeatureFinishProfiles")
+ private String postFeatureFinishProfiles;
+
/**
* Whether to increment the version during feature-finish goal.
*
@@ -110,7 +127,8 @@ public class GitFlowFeatureFinishMojo extends AbstractGitFlowMojo {
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- validateConfiguration(preFeatureFinishGoals, postFeatureFinishGoals);
+ validateConfiguration(preFeatureFinishGoals, preFeatureFinishProfiles,
+ postFeatureFinishGoals, postFeatureFinishProfiles);
try {
// check uncommitted changes
@@ -157,7 +175,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals before merge
if (StringUtils.isNotBlank(preFeatureFinishGoals)) {
- mvnRun(preFeatureFinishGoals);
+ mvnRun(preFeatureFinishGoals, preFeatureFinishProfiles);
}
String featureVersion = getCurrentProjectVersion();
@@ -213,7 +231,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals after merge
if (StringUtils.isNotBlank(postFeatureFinishGoals)) {
- mvnRun(postFeatureFinishGoals);
+ mvnRun(postFeatureFinishGoals, postFeatureFinishProfiles);
}
if (installProject) {
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java
index 013be434..74ac6829 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixFinishMojo.java
@@ -70,6 +70,15 @@ public class GitFlowHotfixFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "preHotfixGoals")
private String preHotfixGoals;
+ /**
+ * Maven profiles to activate in the hotfix branch before merging into the
+ * production or support branch.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "preHotfixProfiles")
+ private String preHotfixProfiles;
+
/**
* Maven goals to execute in the release or support branch after the hotfix.
*
@@ -78,6 +87,14 @@ public class GitFlowHotfixFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "postHotfixGoals")
private String postHotfixGoals;
+ /**
+ * Maven profiles to activate in the release or support branch after the hotfix.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "postHotfixProfiles")
+ private String postHotfixProfiles;
+
/**
* Hotfix version to use in non-interactive mode.
*
@@ -143,7 +160,8 @@ public class GitFlowHotfixFinishMojo extends AbstractGitFlowMojo {
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- validateConfiguration(preHotfixGoals, postHotfixGoals);
+ validateConfiguration(preHotfixGoals, preHotfixProfiles,
+ postHotfixGoals, postHotfixProfiles);
try {
// check uncommitted changes
@@ -220,7 +238,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals before merge
if (StringUtils.isNotBlank(preHotfixGoals)) {
- mvnRun(preHotfixGoals);
+ mvnRun(preHotfixGoals, preHotfixProfiles);
}
String currentHotfixVersion = getCurrentProjectVersion();
@@ -270,7 +288,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals after merge
if (StringUtils.isNotBlank(postHotfixGoals)) {
- mvnRun(postHotfixGoals);
+ mvnRun(postHotfixGoals, postHotfixProfiles);
}
// check whether release branch exists
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java
index 9acfd240..d4e13277 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseFinishMojo.java
@@ -135,6 +135,15 @@ public class GitFlowReleaseFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "preReleaseGoals")
private String preReleaseGoals;
+ /**
+ * Maven profiles to activate in the release branch before merging into the
+ * production branch.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "preReleaseProfiles")
+ private String preReleaseProfiles;
+
/**
* Maven goals to execute in the production branch after the release.
*
@@ -143,6 +152,14 @@ public class GitFlowReleaseFinishMojo extends AbstractGitFlowMojo {
@Parameter(property = "postReleaseGoals")
private String postReleaseGoals;
+ /**
+ * Maven profiles to activate in the production branch after the release.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "postReleaseProfiles")
+ private String postReleaseProfiles;
+
/**
* Whether to make a GPG-signed tag.
*
@@ -182,7 +199,8 @@ public class GitFlowReleaseFinishMojo extends AbstractGitFlowMojo {
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- validateConfiguration(preReleaseGoals, postReleaseGoals);
+ validateConfiguration(preReleaseGoals, preReleaseProfiles,
+ postReleaseGoals, postReleaseProfiles);
try {
// check uncommitted changes
@@ -243,7 +261,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals before merge
if (StringUtils.isNotBlank(preReleaseGoals)) {
- mvnRun(preReleaseGoals);
+ mvnRun(preReleaseGoals, preReleaseProfiles);
}
String currentReleaseVersion = getCurrentProjectVersion();
@@ -285,7 +303,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals after merge
if (StringUtils.isNotBlank(postReleaseGoals)) {
- mvnRun(postReleaseGoals);
+ mvnRun(postReleaseGoals, postReleaseProfiles);
}
if (notSameProdDevName()) {
diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java
index ad64a3c9..cbc19503 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseMojo.java
@@ -29,7 +29,7 @@
/**
* The git flow release mojo.
- *
+ *
* @since 1.2.0
*/
@Mojo(name = "release", aggregator = true)
@@ -41,7 +41,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to skip calling Maven test goal before releasing.
- *
+ *
* @since 1.0.5
*/
@Parameter(property = "skipTestProject", defaultValue = "false")
@@ -49,7 +49,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to allow SNAPSHOT versions in dependencies.
- *
+ *
* @since 1.2.2
*/
@Parameter(property = "allowSnapshots", defaultValue = "false")
@@ -58,7 +58,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to rebase branch or merge. If true
then rebase will
* be performed.
- *
+ *
* @since 1.2.3
*/
@Parameter(property = "releaseRebase", defaultValue = "false")
@@ -66,7 +66,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to use --no-ff
option when merging.
- *
+ *
* @since 1.2.3
*/
@Parameter(property = "releaseMergeNoFF", defaultValue = "true")
@@ -74,7 +74,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to push to the remote.
- *
+ *
* @since 1.3.0
*/
@Parameter(property = "pushRemote", defaultValue = "true")
@@ -83,7 +83,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Release version to use instead of the default next release version in non
* interactive mode.
- *
+ *
* @since 1.3.1
*/
@Parameter(property = "releaseVersion", defaultValue = "")
@@ -91,7 +91,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to use --ff-only
option when merging.
- *
+ *
* @since 1.4.0
*/
@Parameter(property = "releaseMergeFFOnly", defaultValue = "false")
@@ -99,7 +99,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Whether to remove qualifiers from the next development version.
- *
+ *
* @since 1.6.0
*/
@Parameter(property = "digitsOnlyDevVersion", defaultValue = "false")
@@ -108,7 +108,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Development version to use instead of the default next development
* version in non interactive mode.
- *
+ *
* @since 1.6.0
*/
@Parameter(property = "developmentVersion", defaultValue = "")
@@ -117,7 +117,7 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Which digit to increment in the next development version. Starts from
* zero.
- *
+ *
* @since 1.6.0
*/
@Parameter(property = "versionDigitToIncrement")
@@ -125,23 +125,39 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/**
* Maven goals to execute before the release.
- *
+ *
* @since 1.8.0
*/
@Parameter(property = "preReleaseGoals")
private String preReleaseGoals;
+ /**
+ * Maven profiles to activate before the release.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "preReleaseProfiles")
+ private String preReleaseProfiles;
+
/**
* Maven goals to execute after the release.
- *
+ *
* @since 1.8.0
*/
@Parameter(property = "postReleaseGoals")
private String postReleaseGoals;
+ /**
+ * Maven profiles to activate after the release.
+ *
+ * @since 1.20.0
+ */
+ @Parameter(property = "postReleaseProfiles")
+ private String postReleaseProfiles;
+
/**
* Whether to make a GPG-signed tag.
- *
+ *
* @since 1.9.0
*/
@Parameter(property = "gpgSignTag", defaultValue = "false")
@@ -158,7 +174,8 @@ public class GitFlowReleaseMojo extends AbstractGitFlowMojo {
/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- validateConfiguration(preReleaseGoals, postReleaseGoals);
+ validateConfiguration(preReleaseGoals, preReleaseProfiles,
+ postReleaseGoals, postReleaseProfiles);
try {
// set git flow configuration
@@ -243,7 +260,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals before release
if (StringUtils.isNotBlank(preReleaseGoals)) {
- mvnRun(preReleaseGoals);
+ mvnRun(preReleaseGoals, preReleaseProfiles);
}
Map messageProperties = new HashMap<>();
@@ -281,7 +298,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// maven goals after release
if (StringUtils.isNotBlank(postReleaseGoals)) {
- mvnRun(postReleaseGoals);
+ mvnRun(postReleaseGoals, postReleaseProfiles);
}
if (notSameProdDevName()) {