Skip to content

Commit 1c97e42

Browse files
committed
Merge branch 'master' into feature/issue235-version-policy
2 parents 637c6df + f3492cf commit 1c97e42

File tree

111 files changed

+2394
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2394
-213
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
8+
[*.java]
9+
indent_size = 4

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: aleksandr-m

.github/workflows/verify.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: verify
2+
on: [push, pull_request]
3+
jobs:
4+
verify:
5+
strategy:
6+
matrix:
7+
platform: [ubuntu-latest, macos-latest, windows-latest]
8+
runs-on: ${{ matrix.platform }}
9+
steps:
10+
- name: Check out repository
11+
uses: actions/checkout@v2
12+
13+
- name: Set up JDK 7
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 7
17+
18+
- name: Cache Maven packages
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.m2
22+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: ${{ runner.os }}-m2
24+
25+
- name: Maven verify
26+
run: mvn -B verify -Prun-its
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import java.net.*;
17+
import java.io.*;
18+
import java.nio.channels.*;
19+
import java.util.Properties;
20+
21+
public class MavenWrapperDownloader {
22+
23+
private static final String WRAPPER_VERSION = "0.5.6";
24+
/**
25+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26+
*/
27+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29+
30+
/**
31+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32+
* use instead of the default one.
33+
*/
34+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35+
".mvn/wrapper/maven-wrapper.properties";
36+
37+
/**
38+
* Path where the maven-wrapper.jar will be saved to.
39+
*/
40+
private static final String MAVEN_WRAPPER_JAR_PATH =
41+
".mvn/wrapper/maven-wrapper.jar";
42+
43+
/**
44+
* Name of the property which should be used to override the default download url for the wrapper.
45+
*/
46+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47+
48+
public static void main(String args[]) {
49+
System.out.println("- Downloader started");
50+
File baseDirectory = new File(args[0]);
51+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52+
53+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
54+
// wrapperUrl parameter.
55+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56+
String url = DEFAULT_DOWNLOAD_URL;
57+
if(mavenWrapperPropertyFile.exists()) {
58+
FileInputStream mavenWrapperPropertyFileInputStream = null;
59+
try {
60+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61+
Properties mavenWrapperProperties = new Properties();
62+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64+
} catch (IOException e) {
65+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66+
} finally {
67+
try {
68+
if(mavenWrapperPropertyFileInputStream != null) {
69+
mavenWrapperPropertyFileInputStream.close();
70+
}
71+
} catch (IOException e) {
72+
// Ignore ...
73+
}
74+
}
75+
}
76+
System.out.println("- Downloading from: " + url);
77+
78+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79+
if(!outputFile.getParentFile().exists()) {
80+
if(!outputFile.getParentFile().mkdirs()) {
81+
System.out.println(
82+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83+
}
84+
}
85+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86+
try {
87+
downloadFileFromURL(url, outputFile);
88+
System.out.println("Done");
89+
System.exit(0);
90+
} catch (Throwable e) {
91+
System.out.println("- Error downloading");
92+
e.printStackTrace();
93+
System.exit(1);
94+
}
95+
}
96+
97+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99+
String username = System.getenv("MVNW_USERNAME");
100+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101+
Authenticator.setDefault(new Authenticator() {
102+
@Override
103+
protected PasswordAuthentication getPasswordAuthentication() {
104+
return new PasswordAuthentication(username, password);
105+
}
106+
});
107+
}
108+
URL website = new URL(urlString);
109+
ReadableByteChannel rbc;
110+
rbc = Channels.newChannel(website.openStream());
111+
FileOutputStream fos = new FileOutputStream(destination);
112+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113+
fos.close();
114+
rbc.close();
115+
}
116+
117+
}

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# Changelog
22

3+
## v1.17.0 (2021-12-07)
4+
5+
* Fixed and improved error messages in `feature-start` goal - [#306](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/306)
6+
* Added ability to use different commit message on feature squash - [#287](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/287)
7+
* Added ability to increment different digit in hotfix version - [#186](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/186)
8+
* Added ability to disable update of `project.build.outputTimestamp` property - [#310](https://github.com/aleksandr-m/gitflow-maven-plugin/pull/310)
9+
* Added support to automatically use Maven wrapper for internal commands - [#246](https://github.com/aleksandr-m/gitflow-maven-plugin/pull/246)
10+
* Added ability to use `gitFlowConfig` and `commitMessages` properties from the command line - [#284](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/284)
11+
12+
## v1.16.0 (2021-03-23)
13+
14+
* Fixed wrong incrementing of feature name - [#288](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/288)
15+
* Fixed wrong version property update - [#272](https://github.com/aleksandr-m/gitflow-maven-plugin/pull/272)
16+
* Added support for updating `project.build.outputTimestamp` property to support [Maven reproducible builds](https://maven.apache.org/guides/mini/guide-reproducible-builds.html) - [#286](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/286)
17+
* Removed deprecated wrong spelling of commit message parameter
18+
* Added ability to use snapshot version in support branch - [#250](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/250)
19+
* Added ability to change support branch name - [#276](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/276)
20+
* Added ability to use full branch name in feature and hotfix finish goals - [#270](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/270)
21+
22+
## v1.15.1 (2021-01-14)
23+
24+
* Fixed `hotfix-finish` must not increment develop snapshot version [#267](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/267)
25+
26+
## v1.15.0 (2020-11-04)
27+
28+
* Updated java version to 1.7 - [#252](https://github.com/aleksandr-m/gitflow-maven-plugin/pull/252)
29+
* Changed commit logic in `feature-finish` goal to avoid directly committing into the develop - [#226](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/226)
30+
* Fixed wrong development version after `hotfix-finish` - [#211](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/211)
31+
* Fixed failing `hotfix-finish` in fresh checkout - [#219](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/219)
32+
* Added ability to skip merging release into production branch - [#74](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/74)
33+
* Added ability to increment feature version during `feature-finish` goal - [#162](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/162)
34+
* Added current feature branch as the default choice for `feature-finish` - [#227](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/227)
35+
* Added properties to `featureFinishDevMergeMessage` message - [#247](https://github.com/aleksandr-m/gitflow-maven-plugin/issues/247)
36+
337
## v1.14.0 (2019-12-06)
438

539
* Fixed snapshot dependencies check and improved version resolution - [#204](https://github.com/aleksandr-m/gitflow-maven-plugin/pull/204)

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Git-Flow Maven Plugin
22

3+
[![verify](https://github.com/aleksandr-m/gitflow-maven-plugin/workflows/verify/badge.svg)](https://github.com/aleksandr-m/gitflow-maven-plugin/actions)
34
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.amashchenko.maven.plugin/gitflow-maven-plugin/badge.svg?subject=Maven%20Central)](https://maven-badges.herokuapp.com/maven-central/com.amashchenko.maven.plugin/gitflow-maven-plugin/)
45
[![License](https://img.shields.io/badge/License-Apache%20License%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
56

@@ -22,7 +23,7 @@ The plugin is available from Maven Central.
2223
<plugin>
2324
<groupId>com.amashchenko.maven.plugin</groupId>
2425
<artifactId>gitflow-maven-plugin</artifactId>
25-
<version>1.14.0</version>
26+
<version>1.17.0</version>
2627
<configuration>
2728
<!-- optional configuration -->
2829
</configuration>
@@ -60,6 +61,9 @@ To configure this plugin to use single branch model, such as GitHub Flow, just s
6061

6162
That's it!
6263

64+
# Maven Wrapper support
65+
66+
The plugin will automatically use Maven Wrapper for internal Maven goals if plugin is started with the wrapper.
6367

6468
# Eclipse Plugins build with Tycho
6569

@@ -100,6 +104,17 @@ The `gitflow:release`, `gitflow:release-finish` and `gitflow:hotfix-finish` goal
100104
All goals have `gpgSignCommit` parameter. Set it to `true` to sign commits with configured personal key. The default value is `false`.
101105

102106

107+
# Support for Reproducible Builds
108+
109+
[Reproducible builds](https://reproducible-builds.org/) are a set of software development practices that create an independently-verifiable path from source to binary code.
110+
111+
To configure your Maven build to support reproducible builds follow [official guide](https://maven.apache.org/guides/mini/guide-reproducible-builds.html).
112+
113+
If your project has `project.build.outputTimestamp` property this plugin will update its value whenever the versions are updated.
114+
115+
This can be disabled by setting the configuration parameter `updateOutputTimestamp` to `false`.
116+
117+
103118
# Plugin Common Parameters
104119

105120
All parameters are optional. The `gitFlowConfig` parameters defaults are the same as in the example below.
@@ -156,6 +171,7 @@ Since `1.2.1` commit messages can be changed in plugin's configuration section i
156171
<releaseFinishDevMergeMessage></releaseFinishDevMergeMessage>
157172

158173
<featureFinishDevMergeMessage></featureFinishDevMergeMessage>
174+
<featureSquashMessage></featureSquashMessage>
159175

160176
<hotfixFinishMergeMessage></hotfixFinishMergeMessage>
161177
<hotfixFinishDevMergeMessage></hotfixFinishDevMergeMessage>
@@ -181,7 +197,7 @@ Maven properties can be used in commit messages. For example `<featureStartMessa
181197

182198
Note that although `${project.version}` can be used, any changes to version introduced by this goal won't be reflected in a commit message for this goal (see Custom properties).
183199

184-
Commit messages can be prefixed by using `commitMessagePrefix` parameter.
200+
Commit messages can be prefixed by using `commitMessagePrefix` parameter. Leading or trailing whitespaces can be preserved by using `xml:space="preserve"` attribute e.g. `<commitMessagePrefix xml:space="preserve">[gitflow] </commitMessagePrefix>`.
185201

186202
### Custom properties in commit messages
187203

@@ -201,8 +217,7 @@ For example, `-DversionProperty=revision` will update the `<revision>` property
201217

202218
The `skipUpdateVersion` parameter can be used to skip updating `<version>` in the pom.xml. The default value is `false` (i.e. the version will be updated).
203219

204-
To support [CI friendly versioning](https://maven.apache.org/maven-ci-friendly.html) in projects which use `<version>${revision}</version>` (e.g. [spring-boot](https://github.com/spring-projects/spring-boot/blob/master/pom.xml))
205-
set `versionProperty` to `revision` and `skipUpdateVersion` to `true`.
220+
To support [CI friendly versioning](https://maven.apache.org/maven-ci-friendly.html) in projects which use `<version>${revision}</version>` set `versionProperty` to `revision` and `skipUpdateVersion` to `true`.
206221

207222
## Additional goal parameters
208223

@@ -215,6 +230,8 @@ The default value is `false` (e.g. if the project version is `1.0.0-SNAPSHOT` an
215230
The `gitflow:feature-start` goal has `featureNamePattern` parameter which allows to enforce naming of the feature branches with a regular expression. Doesn't have effect if it isn't set or left blank.
216231
By default it isn't set.
217232

233+
The `gitflow:feature-finish` goal has `incrementVersionAtFinish` parameter which if set to `true` will increment version number during feature finish. The default is `false`.
234+
218235
All `-finish` goals have `keepBranch` parameter which controls whether created support branch will be kept in Git after the goal finishes.
219236
The default value is `false` (i.e. the supporting branch will be deleted). If the `pushRemote` parameter is set to `true` and `keepBranch` is `false` remote branch will be deleted as well.
220237

@@ -250,12 +267,16 @@ The `gitflow:release-start` goal has `fromCommit` parameter which allows to star
250267
The `gitflow:release-start` and `gitflow:release-finish` goals have `useSnapshotInRelease` parameter which allows to start the release with SNAPSHOT version and finish it without this value in project version. By default the value is `false`.
251268
For example, if the release version is `1.0.2` and `useSnapshotInRelease` is set to `true` and using `gitflow:release-start` goal then the release version will be `1.0.2-SNAPSHOT` and when finishing the release with `gitflow:release-finish` goal, the release version will be `1.0.2`
252269

270+
The `gitflow:release` and `gitflow:release-start` goals have `skipReleaseMergeProdBranch` parameter which prevents merging the release branch into the production branch. The default value is `false`.
271+
253272
The `gitflow:hotfix-start` and `gitflow:hotfix-finish` goals have `useSnapshotInHotfix` parameter which allows to start the hotfix with SNAPSHOT version and finish it without this value in the version. By default the value is `false`.
254273
For example, if the hotfix version is `1.0.2.1` and `useSnapshotInHotfix` is set to `true` and using `gitflow:hotfix-start` goal then the hotfix version will be `1.0.2.1-SNAPSHOT` and when finishing the release with `gitflow:hotfix-finish` goal, the release version will be `1.0.2.1`
255274

256-
The `gitflow:hotfix-finish` goal also supports the parameter `skipMergeDevBranch` which prevents merging the hotfix branch into the development branch.
275+
The `gitflow:hotfix-finish` goal supports the parameter `skipMergeDevBranch` which prevents merging the hotfix branch into the development branch.
257276

258-
The `gitflow:hotfix-finish` goal also supports the parameter `skipMergeProdBranch` which prevents merging the hotfix branch into the production branch and deletes the hotfix branch leaving only the tagged commit. Useful, along with `skipMergeDevBranch`, to allow hotfixes to very old code that are not applicable to current development.
277+
The `gitflow:hotfix-finish` goal supports the parameter `skipMergeProdBranch` which prevents merging the hotfix branch into the production branch and deletes the hotfix branch leaving only the tagged commit. Useful, along with `skipMergeDevBranch`, to allow hotfixes to very old code that are not applicable to current development.
278+
279+
The `gitflow:hotfix-start` goal has `hotfixVersionDigitToIncrement` parameter which controls which digit to increment in the hotfix version. Starts from zero.
259280

260281
Version update of all modules ignoring groupId and artifactId can be forced by setting `versionsForceUpdate` parameter to `true`. The default value is `false`.
261282

@@ -321,6 +342,8 @@ The `gitflow:release-finish` and `gitflow:release` goals have `developmentVersio
321342

322343
The `gitflow:feature-start` and `gitflow:feature-finish` goals have `featureName` parameter which can be used to set a name of the feature in non-interactive mode.
323344

345+
The `gitflow:feature-finish` goal has `featureBranch` parameter which can be used to set feature branch name in non-interactive mode. It must start with the feature branch prefix. The `featureBranch` will be used instead of `featureName` if both are set.
346+
324347
## Non-interactive Hotfix
325348

326349
The `gitflow:hotfix-start` goal has `fromBranch` parameter which can be used to set starting branch of the hotfix. It can be set to production branch or one of the support branches.
@@ -329,7 +352,13 @@ If it is left blank then hotfix will be started from the production branch.
329352
The `gitflow:hotfix-start` and `gitflow:hotfix-finish` goals have `hotfixVersion` parameter which can be used to set version of the hotfix.
330353
If it is left blank in `gitflow:hotfix-start` goal then the default version will be used.
331354

355+
The `gitflow:hotfix-finish` goal has `hotfixBranch` parameter which can be used to set hotfix branch name in non-interactive mode. It must start with the hotfix branch prefix. The `hotfixBranch` will be used instead of `hotfixVersion` if both are set.
356+
332357
## Non-interactive Support
333358

334359
The `gitflow:support-start` goal can be run in non-interactive mode. Use `tagName` parameter to set tag from which supporting branch will be started.
335360
If `tagName` is not set but the goal is running in non-interactive mode then the last tag will be used.
361+
362+
The `gitflow:support-start` goal has `supportBranchName` parameter which can be used to set branch name to use instead of the default.
363+
364+
The `gitflow:support-start` goal has `useSnapshotInSupport` parameter which allows to start the support with SNAPSHOT version.

0 commit comments

Comments
 (0)