diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index 28b04e7b..d899d129 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -10,16 +10,16 @@ jobs:
- name: Check out repository
uses: actions/checkout@v3
- - name: Set up JDK 7
- uses: actions/setup-java@v2
+ - name: Set up JDK
+ uses: actions/setup-java@v3
with:
- distribution: 'zulu'
- java-version: 7
+ distribution: 'temurin'
+ java-version: 8
- name: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
- maven-version: 3.8.4
+ maven-version: 3.9.1
- name: Cache Maven packages
uses: actions/cache@v3
@@ -34,5 +34,5 @@ jobs:
- uses: actions/upload-artifact@v3
if: failure()
with:
- name: it-build-logs
+ name: ${{ runner.os }}-it-build-logs
path: target/it/*/*.log
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 8c79a83a..d8b2495a 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -5,14 +5,14 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
diff --git a/pom.xml b/pom.xml
index 2f272cf9..03f0a9f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,9 +63,9 @@
- 1.7
+ 8
UTF-8
- 3.6.0
+ 3.8.2
@@ -99,7 +99,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ 3.11.0
${java.version}
@@ -109,7 +109,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.3.1
+ 3.5.0
@@ -117,7 +117,7 @@
org.apache.maven.plugins
maven-site-plugin
- 3.7.1
+ 3.12.1
org.apache.maven.plugins
@@ -153,7 +153,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.1.0
+ 3.2.1
attach-sources
@@ -178,7 +178,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.0.1
sign-artifacts
@@ -198,7 +198,7 @@
maven-invoker-plugin
- 3.2.2
+ 3.5.1
${project.build.directory}/it
${project.build.directory}/local-repo
@@ -224,41 +224,36 @@
org.apache.maven
maven-core
- 3.8.5
+ 3.9.0
+ provided
org.codehaus.plexus
plexus-utils
- 1.5.15
+ 3.5.1
org.apache.maven.plugin-tools
maven-plugin-annotations
- 3.6.4
+ 3.8.2
provided
-
- org.codehaus.plexus
- plexus-interactivity-api
- 1.1
- compile
-
org.apache.maven.release
maven-release-manager
- 2.5.3
+ 3.0.0
compile
org.apache.maven.release
maven-release-oddeven-policy
- 2.5.3
+ 3.0.0
test
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter
+ 5.9.3
test
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 7a4b4e20..8e10eb6c 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
@@ -18,6 +18,7 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
@@ -25,6 +26,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
+import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
@@ -44,6 +46,7 @@
import org.apache.maven.shared.release.policy.version.VersionPolicy;
import org.codehaus.plexus.components.interactivity.Prompter;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -206,16 +209,16 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
*
* @since 1.18.0
*/
- @Parameter(property = "versionsMavenPluginVersion", defaultValue = "2.8.1")
- private String versionsMavenPluginVersion = "2.8.1";
+ @Parameter(property = "versionsMavenPluginVersion", defaultValue = "2.15.0")
+ private String versionsMavenPluginVersion = "2.25.0";
/**
* Version of tycho-versions-plugin to use.
*
* @since 1.18.0
*/
- @Parameter(property = "tychoVersionsPluginVersion", defaultValue = "0.24.0")
- private String tychoVersionsPluginVersion = "0.24.0";
+ @Parameter(property = "tychoVersionsPluginVersion", defaultValue = "1.7.0")
+ private String tychoVersionsPluginVersion = "1.7.0";
/**
* Options to pass to Git push command using --push-option
.
@@ -546,7 +549,12 @@ protected void initGitFlowConfig() throws MojoFailureException, CommandLineExcep
*/
private void gitSetConfig(final String name, String value) throws MojoFailureException, CommandLineException {
if (value == null || value.isEmpty()) {
- value = "\"\"";
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ value = "\"\"";
+ }
+ else {
+ value = "";
+ }
}
// ignore error exit codes
@@ -636,7 +644,7 @@ protected String gitFindTags() throws MojoFailureException, CommandLineException
* If command line execution fails.
*/
protected String gitFindLastTag() throws MojoFailureException, CommandLineException {
- String tag = executeGitCommandReturn("for-each-ref", "--sort=\"-version:refname\"", "--sort=-taggerdate",
+ String tag = executeGitCommandReturn("for-each-ref", "--sort=-version:refname", "--sort=-taggerdate",
"--count=1", "--format=\"%(refname:short)\"", "refs/tags/");
// https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3
tag = removeQuotes(tag);
@@ -848,12 +856,12 @@ protected void gitCommit(String message, Map messageProperties)
protected void gitMerge(final String branchName, boolean rebase, boolean noff, boolean ffonly, String message,
Map messageProperties)
throws MojoFailureException, CommandLineException {
- String sign = "";
+ String sign = null;
if (gpgSignCommit) {
sign = "-S";
}
- String msgParam = "";
- String msg = "";
+ String msgParam = null;
+ String msg = null;
if (StringUtils.isNotBlank(message)) {
if (StringUtils.isNotBlank(commitMessagePrefix)) {
message = commitMessagePrefix + message;
@@ -1123,15 +1131,9 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
getLog().info("Updating version(s) to '" + version + "'.");
String newVersion = "-DnewVersion=" + version;
- String grp = "";
- String art = "";
- if (versionsForceUpdate) {
- grp = "-DgroupId=";
- art = "-DartifactId=";
- }
if (tychoBuild) {
- String prop = "";
+ String prop = null;
if (StringUtils.isNotBlank(versionProperty)) {
prop = "-Dproperties=" + versionProperty;
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'.");
@@ -1147,8 +1149,10 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
if (!skipUpdateVersion) {
runCommand = true;
args.add(VERSIONS_MAVEN_PLUGIN + ":" + versionsMavenPluginVersion + ":" + VERSIONS_MAVEN_PLUGIN_SET_GOAL);
- args.add(grp);
- args.add(art);
+ if (versionsForceUpdate) {
+ args.add("-DgroupId=");
+ args.add("-DartifactId=");
+ }
}
if (StringUtils.isNotBlank(versionProperty)) {
@@ -1324,7 +1328,8 @@ private CommandResult executeCommand(final Commandline cmd, final boolean failOn
}
cmd.clearArgs();
- cmd.addArguments(args);
+ String[] nonNullArgs = Arrays.stream(args).filter(Objects::nonNull).toArray(String[]::new);
+ cmd.addArguments(nonNullArgs);
if (StringUtils.isNotBlank(argStr)) {
cmd.createArg().setLine(argStr);
@@ -1344,7 +1349,7 @@ private CommandResult executeCommand(final Commandline cmd, final boolean failOn
// not all commands print errors to error stream
errorStr += LS + outStr;
- throw new MojoFailureException(errorStr);
+ throw new MojoFailureException("Failed cmd ["+cmd.getExecutable()+"] with args [" + Arrays.toString(cmd.getArguments()) + "], bad exit code [" + exitCode +"]. Out: [" + errorStr+ "]");
}
if (verbose && StringUtils.isNotBlank(errorStr)) {
diff --git a/src/test/java/com/amashchenko/maven/plugin/gitflow/FeatureVersionTest.java b/src/test/java/com/amashchenko/maven/plugin/gitflow/FeatureVersionTest.java
index bf7044db..30ef7de7 100644
--- a/src/test/java/com/amashchenko/maven/plugin/gitflow/FeatureVersionTest.java
+++ b/src/test/java/com/amashchenko/maven/plugin/gitflow/FeatureVersionTest.java
@@ -18,26 +18,13 @@
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
-public class FeatureVersionTest {
- private final String version;
- private final String featureName;
- private final String expectedVersion;
+import static org.junit.jupiter.api.Assertions.assertEquals;
- public FeatureVersionTest(final String version, final String featureName,
- final String expectedVersion) {
- this.version = version;
- this.featureName = featureName;
- this.expectedVersion = expectedVersion;
- }
+public class FeatureVersionTest {
- @Parameters
public static Collection