-
-
Notifications
You must be signed in to change notification settings - Fork 41
Introduce jgitver maven plugin in existing project
Introducing jgitver-maven-plugin into an existing project is easy.
Let's suppose you use SNAPSHOTS
for your project and that your latest released version is 2.4.0
thus your master might be 2.4.1-SNAPSHOT
(see bottom page for a project example).
Then introducing jgitver-maven-plugin is just few steps ahead:
-
go to your project directory
cd demo2
-
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"
-
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::demo2::0 -> 2.4.1-SNAPSHOT [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building demo2 2.4.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.587 s [INFO] Finished at: 2016-12-14T20:42:54+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=demo2 \
-Dpackage=fr.brouillard.jgitver.demos \
-Dversion=1.0.0-SNAPSHOT
cd demo2
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=2.4.1-SNAPSHOT && mvn versions:commit
git add -u
git commit -m "switch to 2.4.1-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