Skip to content
This Maven plugin aims to provide a better experience regarding version management in Maven by introducing a new lifecycle.
Java Groovy
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
.gitattributes
.gitignore
LICENSE feat: Initial commit Mar 22, 2020
README.md docs: Add notice about beta Mar 23, 2020
license-header.txt
pom.xml

README.md

Version lifecycle plugin

CircleCI

This Maven plugin aims to provide a better experience regarding version management in Maven. It does this by introducing a new lifecycle. This allows to bump major, minor or patch version numbers with a simple command while still being able to run other plugins during the creation of the version. Output generated from these plugins can easily be added and included in the release tag.

Maturity

This project is still during beta, but feel free to use it to test it out!

Usage

Major versions

$ mvn version -Dmajor

Minor versions

$ mvn version -Dminor

Patch versions

$ mvn version -Dpatch

Inspiration

This plugin has gotten a lot of inspiration from the npm version command, which is a great tool for managing your versions. It's also inspired by Versions Maven Plugin and actually uses some of its goals as the default goals for some of the lifecycle phases.

Assumptions

This project tries to not asume too much about your work flow, but it does assume a few things. It assumes that...

  • ... you are using Git as your version control system.
  • ... artifacts will be published either by a CI tool or manually after the release is created. This lifecycle has no relation to the deploy lifecycle phase.

The lifecycle

Here is an explained table of the whole lifecycle:

Phase Task
version-validate Does nothing by default. A good place to perform pre-flight checks.
version-prepare-release Prepares the lifecycle by finding out the next version for the specified type.
version-prepare-release-version Sets the version attribute in the POM.
version-prepare-release-tag Sets the scm.tag attribute in the POM.
version-process-release Does nothing by default. A good place to make any pre-commit changes to files, such as generating changelog.
version-commit-release Commits the changes for the release.
version-prepare-snapshot Prepares the lifecycle by finding out the next development version.
version-prepare-snapshot-version Sets the version attribute in the POM.
version-prepare-snapshot-tag Sets the scm.tag attribute in the POM.
version-process-snapshot Does nothing by default. A good place to make any pre-commit changes to files.
version-commit-snapshot Commits the changes for the snapshot version.
version Does nothing. Its sole purpose is to provide a neat command to create new versions.

Parameters

Name Property Default value Description
major Triggers a major version bump. Mutually exclusive with minor and patch.
minor Triggers a major version bump. Mutually exclusive with major and patch.
patch Triggers a major version bump. Mutually exclusive with major and minor.
tagPrefix version.tagPrefix v The prefix for release tags.
tagSuffix version.tagSuffix The suffix for release tags.
generateBackupPoms generateBackupPoms false Indicates whether or not to generate backup POMs when changes are made.
releaseCommitMessagePattern version.releaseCommitMessagePattern [version] The commit message to use for releases. The placeholder [version] will be replaced with the actual version number.
snapshotCommitMessagePattern version.snapshotCommitMessagePattern Preparing for the next development iteration The commit message to use for snapshots.
releaseFilePatternsToAdd version.releaseFilePatternsToAdd . File patterns to add to the Git index before committing the release.
snapshotFilePatternsToAdd version.snapshotFilePatternsToAdd . File patterns to add to the Git index before committing the snapshot.

Signed commits

There is an issue with signed commits. JGit (the underlying library for managing Git operations) does not have support for GPG 2.2 file format. The file, ~/.gnupg/pubring.kbx will be considered empty. A workaround for this is the following command, which will provide an older format:

$ gpg --export > ~/.gnupg/pubring.gpg

Release

For releasing this project, use:

$ git checkout <tag to deploy>
$ mvn deploy -Psonatype-oss-release

Use -Dgpg.keyname=<ID of key> if you have multiple GPG keys and want to select one.

License

Apache License © Anton Johansson

You can’t perform that action at this time.