You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,17 +96,17 @@ In practice, the Maven versions should:
96
96
The `enforce-versions` goal asserts these semantics when it can resolve the `gitBranchExpression`.
97
97
98
98
The goal accomplishes this by checking the Maven pom.xml version value, and asserting the -SNAPSHOT status, as well as matching the current branch name
99
-
against regular expressions, extracting version numbers from the branch names where applicable. If a regex specifies a subgroup 1, the content of that
100
-
subgroup is asserted to equal the version defined in the pom.xml.
99
+
against regular expressions, extracting version numbers from the branch names where applicable. If a regex specifies subgroups, the content of the
100
+
last subgroup is asserted to equal the version defined in the pom.xml.
101
101
102
102
The following properties change the behavior of this goal:
| gitBranchExpression | current git branch resolved from SCM or ${env.GIT_BRANCH} | n/a | Maven property expression to resolve in order to determine the current git branch |
107
107
| masterBranchPattern | origin/master | No | Regex. When matched, signals the master branch is being built. Note the lack of a subgroup. |
108
-
| releaseBranchPattern | origin/release/(.*) | No | Regex. When matched, signals a release branch being built. Subgroup 1, if present, must match the Maven project version. |
109
-
| hotfixBranchPattern | origin/hotfix/(.*) | No | Regex. When matched, signals a hotfix branch is being built. Subgroup 1, if present, must match the Maven project version. |
108
+
| releaseBranchPattern | origin/release/(.*) | No | Regex. When matched, signals a release branch being built. Last subgroup, if present, must match the Maven project version. |
109
+
| hotfixBranchPattern | origin/hotfix/(.*) | No | Regex. When matched, signals a hotfix branch is being built. Last subgroup, if present, must match the Maven project version. |
110
110
| developmentBranchPattern | origin/develop | Yes | Regex. When matched, signals a development branch is being built. Note the lack of a subgroup. |
111
111
112
112
## Goal: `retarget-deploy` (Branch Specific Deploy Targets & Staging)
Copy file name to clipboardExpand all lines: src/main/java/com/e_gineering/maven/gitflowhelper/EnforceVersionsMojo.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,8 @@ protected void execute(final GitBranchType type, final String gitBranch, final S
28
28
thrownewMojoFailureException("The current git branch: [" + gitBranch + "] is defined as a release branch. The maven project version: [" + project.getVersion() + "] is currently a snapshot version.");
29
29
}
30
30
31
-
// Expect the last group to match (exactly) the current projectVersion.
32
-
if (gitMatcher.groupCount() > 0) {
31
+
// Expect the last group on non-master branches to match (exactly) the current projectVersion. (only release / hotfix branches)
32
+
if (gitMatcher.groupCount() > 0 && !GitBranchType.MASTER.equals(type)) {
33
33
if (!gitMatcher.group(gitMatcher.groupCount()).trim().equals(project.getVersion().trim())) {
34
34
thrownewMojoFailureException("The current git branch: [" + gitBranch + "] expected the maven project version to be: [" + gitMatcher.group(gitMatcher.groupCount()).trim() + "], but the maven project version is: [" + project.getVersion() + "]");
0 commit comments