Skip to content

dwmkerr/java-gradle-standard-version-sample

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

Java Gradle Standard Version Sample

This simple module demos how to use Conventional Commits, Git Hooks to enforce Conventional Commits and Semantic Versioning in a Java project built with Gradle.

This is the companion project to the article Supercharge your Java Projects with Conventional Commits, Semantic Versioning and Semantic Releases.

Also, if you want to see what the code looks like after we've added the changelog etc, check the release branch.

Developer Guide

Make sure you have setup your local Git Hooks:

git config core.hooksPath .githooks

This will make sure your commit messages follow the Conventional Commits Specification.

Here's some handly commands:

Command Usage
./mvnw -B verify Run the tests.
./mvnw -B package Run the builds.

Semantic Versioning

This project uses standard-release to update the version in the pom.xml file from the changes in the history and to create the CHANGELOG.md file.

To setup semantic versioning and create the baseline changelog, run:

npx dwmkerr/standard-version --first-release --packageFiles pom.xml --bumpFiles pom.xml

Now any time you want to cut a new release, run:

npx dwmkerr/standard-version --packageFiles pom.xml --bumpFiles pom.xml

This will:

  • Update the CHANGELOG.md
  • Update the version number based on the commit history
  • Create a git tag with the new version number

Finally, just push the tag to trigger a deployment of the new version:

git push --follow-tags

About

This simple module demos how to use Conventional Commits, Git Hooks to enforce Conventional Commits and Semantic Versioning in a Java project built with Maven.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages