Skip to content

Commit

Permalink
Dropping the actual vCC version policy
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Mar 6, 2023
1 parent 37c35eb commit 4221ae4
Show file tree
Hide file tree
Showing 17 changed files with 4 additions and 1,431 deletions.
6 changes: 0 additions & 6 deletions maven-release-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-ccsemver-policy</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>junit</groupId>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.Date;

/**
* A dummy SCM provider used to provide commit messages and tags for testing the Conventional Commits Version Policy.
* A dummy SCM provider used to provide commit messages and tags for testing Version Policies that need this.
*
* @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="dummytags"
* @author Niels Basjes
Expand Down Expand Up @@ -105,7 +105,7 @@ public ChangeLogScmResult changeLog(ChangeLogScmRequest request)

ScmResult scmResult = new ScmResult(
"No command",
"Special for CCSemVer testing",
"Special for testing Scm based version policies",
"No command output",
true
);
Expand Down
93 changes: 2 additions & 91 deletions maven-release-plugin/src/site/apt/usage.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ mvn -Dusername=your_scm_username release:prepare
<artifactId>maven-release-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<projectVersionPolicyId>CCSemVerVersionPolicy</projectVersionPolicyId>
<projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
</configuration>
</plugin>
</plugins>
Expand All @@ -181,7 +181,7 @@ mvn -Dusername=your_scm_username release:prepare
</project>
+-------------------

There are 4 VersionPolicies bundled with the Release Plugin:
There are 3 VersionPolicies bundled with the Release Plugin:

* default: \
This compares and increments versions for a common java versioning scheme.
Expand All @@ -191,92 +191,3 @@ mvn -Dusername=your_scm_username release:prepare

* SemVerVersionPolicy: \
A version policy that enforce SemVer format and upgrades minor element for next development version.

* CCSemVerVersionPolicy (since 3.0.0-M8): \
A version policy that enforces the SemVer format and uses Conventional Commits to determine the next version.

* CCSemVerVersionPolicy

The CCSemVerVersionPolicy is different in the sense that it goes beyond the project version specified in the pom.xml
and tries to analyze the SCM history and from the tags and commit messages it calculates the next version.
For this a few additional configuration options are available.

The calculation works as follows:

* It tries to find the previously released version by searching for the previous release tag.
Here the configured <<<versionTag>>> regex is used to locate and extract (the regex MUST have exactly
1 capture group) the correct value.
If no matching tags are found the project version from the pom.xml is used as the fallback reference point.

* By default it assumes that only a patch release (i.e. <<<?.?.+1>>> ) is needed.

* If any of the commit messages since the previous release tag match any of the of <<<minorRules>>> regexes then
it assumes the next release is a minor release (i.e. <<<?.+1.0>>> ).

* If any of the commit messages since the previous release tag match any of the of <<<majorRules>>> regexes then
it assumes the next release is a major release (i.e. <<<+1.0.0>>> ).

The next development version is always calculated as the release version and then <<<?.?.+1-SNAPSHOT>>>.

When doing <<<mvn release:prepare -X>>> the details about the found tags, commit messages and the used patterns
are output to the console.

The default configuration assumes a version tag that is just the version (i.e. something like <<<1.2.3>>>) and
the rules from the {{{https://www.conventionalcommits.org/en/v1.0.0/}Conventional Commits v1.0.0}} are followed.

If you want a different tag format this will usually result in setting it both when creating the tag and
for finding it again:

+-------------------
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<projectVersionPolicyId>CCSemVerVersionPolicy</projectVersionPolicyId>
<projectVersionPolicyConfig>
<versionTag>^v([0-9]+\.[0-9]+\.[0-9]+)$</versionTag>
</projectVersionPolicyConfig>
</configuration>
+-------------------

If either the minor or major rules are specified then all default rules (both minor and major) are dropped
in favour of the configuration.

+-------+
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>

<projectVersionPolicyId>CCSemVerVersionPolicy</projectVersionPolicyId>

<!-- projectVersionPolicyConfig for the CCSemVerVersionPolicy is an XML structure: -->
<!-- versionTag: A regex with 1 capture group that MUST extract the project.version from the SCM tag. -->
<!-- minorRules: A list regexes that will be matched against all lines in each commit message since -->
<!-- the last tag. If matched the next version is at least a MINOR update. -->
<!-- majorRules: A list regexes that will be matched against all lines in each commit message since -->
<!-- the last tag. If matched the next version is at least a MAJOR update. -->
<!-- If a match is found the commit will trigger either a minor or major version increase -->
<!-- instead of only a patch increase. -->
<projectVersionPolicyConfig>
<versionTag>^v([0-9]+\.[0-9]+\.[0-9]+)$</versionTag>
<majorRules>
<majorRule>^[a-zA-Z]+!(?:\([a-zA-Z0-9_-]+\))?: .*$</majorRule>
<majorRule>^BREAKING CHANGE:.*$</majorRule>
</majorRules>
<minorRules>
<minorRule>^feat(?:\([a-zA-Z0-9_-]+\))?: .*$</minorRule>
</minorRules>
</projectVersionPolicyConfig>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
+-------+
120 changes: 0 additions & 120 deletions maven-release-policies/maven-release-ccsemver-policy/pom.xml

This file was deleted.

Loading

0 comments on commit 4221ae4

Please sign in to comment.