-
-
Notifications
You must be signed in to change notification settings - Fork 41
Use a lightweight tag to change project version
In this example we'll consider quite the same example than inside Introduce jgitver-maven-plugin in existing project except that we expect the version after release 2.4.0
to be 3.0.0-SNAPSHOT
(see bottom page for a project example).
Here we'll follow quite the same steps plus an additional one to tell jgitver-maven-plugin that we want 3.0.0-SNAPSHOT
to be the current version:
-
go to your project directory
cd demo3
-
create maven extension file to use jgitver-maven-plugin
this step just consists in creating a
.mvn
directory whith anextensions.xml
file, see README or use the following command:sh -c "$(wget https://raw.githubusercontent.com/jgitver/jgitver-maven-plugin/master/src/doc/scripts/install.sh -O -)"
-
let's clarify that you now use jgitver-maven-plugin by forcing the version in POMs to 0
mvn versions:set -DnewVersion=0 && mvn versions:commit
-
let's commit the addition of jgitver-maven-plugin and the new version
git add .mvn git add -u git commit -m "introduction of jgitver-maven-plugin, set version to 0"
-
use a lightweight tag to define version to
3.0.0-SNAPSHOT
Do not set a comment on the tag, nor use -a
or -s
or it will become an annotated one.
```
git tag 3.0.0-SNAPSHOT
```
-
you're done
mvn validate [INFO] Scanning for projects... [INFO] jgitver-maven-plugin is about to change project(s) version(s) [INFO] fr.brouillard.jgitver.demos::demo3::0 -> 3.0.0-SNAPSHOT [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building demo3 3.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.550 s [INFO] Finished at: 2016-12-14T20:56:51+01:00 [INFO] Final Memory: 8M/198M [INFO] ------------------------------------------------------------------------
mvn archetype:generate -B \
-DarchetypeCatalog=internal \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.1 \
-DgroupId=fr.brouillard.jgitver.demos \
-DartifactId=demo3 \
-Dpackage=fr.brouillard.jgitver.demos \
-Dversion=1.0.0-SNAPSHOT
cd demo3
git init
git config user.name "Bob TheBuilder"
git config user.email bobthebuilder@nowhere.com
echo "target/" > .gitignore
echo "Init" > actions
git add .
git commit -m "initial commit"
mvn versions:set -DnewVersion=1.0.0 && mvn versions:commit
git add -u
git commit -m "release 1.0.0"
git tag -m "release 1.0.0" 1.0.0
mvn versions:set -DnewVersion=2.4.0-SNAPSHOT && mvn versions:commit
echo "Some action for 2.4.0-SNAPSHOT" >> actions
git add -u
git commit -m "switch to 2.4.0-SNAPSHOT"
mvn versions:set -DnewVersion=2.4.0 && mvn versions:commit
git add -u
git commit -m "release 2.4.0"
git tag -m "release 2.4.0" 2.4.0
mvn versions:set -DnewVersion=3.0.0-SNAPSHOT && mvn versions:commit
git add -u
git commit -m "switch to 3.0.0-SNAPSHOT"
Usage guide
- Starting from scratch
- Introduce jgitver-maven-plugin in existing project
- Use a lightweight tag to change project version
IDE usage
Continuous integration
- native GIT aware travis-ci circle-ci
- jenkins integration multibranch pipeline
- continuous deployment - semi automated
- automatic builds for maven, jenkins and gitbucket
Developer & contributions guide