Gitflow Helper Maven Plugin

An extension and plugin that teaches Maven to work well with gitflow projects and CI servers.


Version 1.1.7 was released February 28, 2017

Download from GitHub

Basic usage

A build extension and plugin that helps Maven play nicely with gitflow projects, CI servers and local development.It does so by:

  • Enforcing gitflow version heuristics in Maven projects.
  • Coercing Maven to gracefully support the gitflow workflow without imposing complex CI job configurations or complex Maven setups.
    • Setting distributionManagement repositories (for things like maven-deploy-plugin) based upon the current git branch.
    • SCM tagging builds for master and support branches. You can use the project SCM definition, or if you omit it, you can resolve the CI server's repository connection information. (Zero Maven scm configuration necessary)
    • Promoting existing tested (staged) artifacts for release, rather than re-building the artifacts. Eliminates the risk of accidental master merges or commits resulting in untested code being released, and provides digest hash traceability for the history of artifacts.
    • Enabling the decoupling of repository deployment and execution environment delivery based on the current git branch.
  • Automated deployment, promotion, and delivery of projects without the maven-release-plugin or some other almost there solution.
  • Customizing maven project and system properties based upon the current branch being built. This allows test cases to target different execution environments without changing the artifact results.
  • Enabling automatic purging and resolving (force update) of 'release' and 'hotfix' release versioned dependencies resolved from the 'stage' repository.

Why would I want to use this?

This plugin solves a few specific issues common in consolidated Hudson/Jenkins Continuous Integration (CI) and Continuous Delivery (CD) jobs for projects following the gitflow workflow.

  1. Ensure the developers are following the (git branching) project version rules, and fail the build if they are not.
  2. Enable the maven-deploy-plugin to target a snapshots, test-releases, and releases repository.
  3. Copy (rather than rebuild) the tested artifacts from the test-releases repository to the release repository, without doing a full project rebuild from the master or support branches.
  4. Set arbitrary project properties based upon the type of GIT branch being built.
  5. Reliably tag deploy builds from the master and support branches
  6. Enable split 'deploy' vs. 'deliver' maven CI job configuration, without rebuilding artifacts for the 'deliver' phase.

In addition to supporting these goals for the project, this plugin does it in a manner that tries to be as effortless (yet configurable) as possible. If you use non-standard gitflow branch names (emer instead of hotfix), this plugin supports that. If you don't want to do version enforcement, this plugin supports that. If you want to use scm tagging with a custom tag format, we support that. If you want to use scm tagging without having to add the section to your pom.xml or adding arcane -Dproperty arguments to your Maven command, this plugin supports that. If you want to do three-tier deployments (snapshot, stage, production) without 'professional' artifact repository tools, and without having to define a section to your pom.xml, yep, this plugin supports that too.All of the solutions to these issues are implemented independently in different plugin goals, so you can pick and choose what parts you'd like to leverage.

Bryan Varner

Company E-gineering