aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
490 stars 182 forks source link

DO NOT MERGE: allow using HEAD-SNAPSHOT with incremental release version #280

Closed vegegoku closed 3 years ago

vegegoku commented 3 years ago

This is a pull request to address issue #266 sorry for coming to this too late.

this PR is meant for discussing a possible solution to this issue, the idea is that I want to use a single snapshot version e.g HEAD-SNAPSHOT for the development while using the incremental release version feature

the idea in this pull request is to use different properties from the project to hold the values for the next snapshot version and next release value, and the plugin will read from those properties instead of using the current project version.

Example

In the project properties, we can define 2 properties one for snapshot version and one for release version

<properties>
        <next.snapshot.version>HEAD-SNAPSHOT</next.snapshot.version>
        <next.release.version>1.0.3</next.release.version>
</properties>

in the plugin configuration

we could have something like this


<plugin>
    <groupId>com.amashchenko.maven.plugin</groupId>
    <artifactId>gitflow-maven-plugin</artifactId>
    <version>1.15.3-SNAPSHOT</version>
    <configuration>
        <!-- tell the plugin which properties to use -->
        <snapshotVersionProperty>next.snapshot.version</snapshotVersionProperty>
        <releaseVersionProperty>next.release.version</releaseVersionProperty>
        <!--  -->
        <commitDevelopmentVersionAtStart>true</commitDevelopmentVersionAtStart>
        <versionDigitToIncrement>${bump.digit}</versionDigitToIncrement>
        <preReleaseGoals>verify</preReleaseGoals>
        <preHotfixGoals>verify</preHotfixGoals>

        <gitFlowConfig>
        <productionBranch>main</productionBranch>
        <developmentBranch>development</developmentBranch>
        </gitFlowConfig>
    </configuration>
</plugin>

And then when we go through the release start/finish process we end up with a release tag branch with the new incremented release version while the development branch will remain always on HEAD-SNAPSHOT

if the properties are not provided the plugin will use the default behavior.

Please notice that this is my first time ever look at a maven plugin code and my first code related to a maven plugin, so I am not very confident about my code but I made this PR to demonstrate my idea.

Thank you.

aleksandr-m commented 3 years ago

@vegegoku Have you tried with skipUpdateVersion and version in property?