Search code examples
mavenversion-controlversionversioningmaven-release-plugin

Maven automate versioning and changelog generation


I want to automate version and changelog creation from Git commits. So it's basically the same thing as npm standard-version but it's for Maven. So how can I achieve the versioning automatically?

additional information: I want to increase the version at POM file using the Git Commit-lint messages. In npm if you commit features it increases MINOR, and if you commit fix it increases PATCH version automatically at Semantic Versioning and creates a changelog for these changes. I was wondering if there is a similar way for Maven?


Solution

  • I couldn't find a direct way for Maven. However, you can still use standard-version to create the changelog and bump up the version. You have to write a script to make package.json and Maven versions same. I used the Versions Maven Plugin to accomplish it.

    mvn versions:set -DnewVersion=%npm_package_version% && mvn versions:commit