Version lifecycle plugin

Parent for all of Viskan System AB's Java projects.

License

License

Categories

Categories

Maven Build Tools Ant
GroupId

GroupId

com.anton-johansson
ArtifactId

ArtifactId

version-lifecycle-maven-plugin
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Version lifecycle plugin
Parent for all of Viskan System AB's Java projects.
Project URL

Project URL

https://github.com/anton-johansson/version-lifecycle-maven-plugin
Project Organization

Project Organization

Viskan System AB
Source Code Management

Source Code Management

https://github.com/anton-johansson/version-lifecycle-maven-plugin

Download version-lifecycle-maven-plugin

How to add to project

<plugin>
    <groupId>com.anton-johansson</groupId>
    <artifactId>version-lifecycle-maven-plugin</artifactId>
    <version>0.2.0</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
com.github.zafarkhaja : java-semver jar 0.9.0
org.eclipse.jgit : org.eclipse.jgit jar 5.7.0.202003110725-r
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven : maven-core jar 3.6.3
org.codehaus.plexus : plexus-utils jar 3.3.0
org.codehaus.plexus : plexus-interactivity-api jar 1.0

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.8.2

Project Modules

There are no modules declared in this project.

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

Versions

Version
0.2.0
0.1.0