Skip to content

Commit

Permalink
Merge pull request #389 from DRoppelt/java8Baseline
Browse files Browse the repository at this point in the history
Java8 baseline & bump all dependencies
  • Loading branch information
aleksandr-m authored Aug 22, 2023
2 parents 42fcd1e + fa72893 commit 4185827
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 168 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 4 additions & 4 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 17 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
</distributionManagement>

<properties>
<java.version>1.7</java.version>
<java.version>8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version>
<maven-plugin-plugin.version>3.8.2</maven-plugin-plugin.version>
</properties>

<reporting>
Expand Down Expand Up @@ -99,7 +99,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -109,15 +109,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.5.0</version>
<configuration>
<source>${java.version}</source>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -153,7 +153,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -178,7 +178,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -198,7 +198,7 @@
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.2</version>
<version>3.5.1</version>
<configuration>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
Expand All @@ -224,41 +224,36 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.8.5</version>
<version>3.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.5.15</version><!-- cannot go to 3.X without breaking java7 compatibiltiy -->
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.4</version>
<version>3.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-manager</artifactId>
<version>2.5.3</version>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-oddeven-policy</artifactId>
<version>2.5.3</version>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
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;
import java.util.List;
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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 <code>--push-option</code>.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -848,12 +856,12 @@ protected void gitCommit(String message, Map<String, String> messageProperties)
protected void gitMerge(final String branchName, boolean rebase, boolean noff, boolean ffonly, String message,
Map<String, String> 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;
Expand Down Expand Up @@ -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 + "'.");
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);
Expand All @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "0.9-SNAPSHOT", "feature", "0.9-feature-SNAPSHOT" },
Expand All @@ -48,9 +35,11 @@ public static Collection<Object[]> data() {
{ "0.9-RC3", null, "0.9-RC3" } });
}

@Test
public void testFeatureVersion() throws Exception {
Assert.assertEquals(expectedVersion,
@ParameterizedTest
@MethodSource("data")
public void testFeatureVersion(final String version, final String featureName,
final String expectedVersion) throws Exception {
assertEquals(expectedVersion,
new GitFlowVersionInfo(version, null).featureVersion(featureName));
}
}
Loading

0 comments on commit 4185827

Please sign in to comment.