Difficulty: Beginner
Estimated Time: 10 minutes

Welcome to this jgitver maven demo.

In this tutorial, you will see how to integrate jgitver into an existing maven project.

jgitver will allow automatic project version computation based on git information (tags, commits, branches, ...)

jgitver maven simple usage

For now let's move to the next slide.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

jgitver Maven introduction on docker

Step 1 of 3

project initialization

Open a docker container with all the required tooling: maven, git.

docker run -it --rm maven:3.5 /bin/bash

Let's create a default maven project.

mvn archetype:generate \ -DgroupId=fr.brouillard.jgitver.demos \ -DartifactId=simple-maven-demo \ -Dversion=1.0.0-SNAPSHOT \ -Dpackage=fr.brouillard.jgitver.demos \ -DarchetypeArtifactId=maven-archetype-quickstart \ -DinteractiveMode=false \ -DarchetypeCatalog=local

With some git history

cd simple-maven-demo && \ git init && \ git config user.name "Scrap Kata-Coda" && \ git config user.email "[email protected]" && \ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" && \ echo target/ > .gitignore && \ git add . && \ git commit -m "initial version"

We now have a default running maven project

mvn validate

which version is defined by the pom version node as 1.0.0-SNAPSHOT

grep -E --color=auto '^.*1.0.0-SNAPSHOT.*$|$' pom.xml