Skip to content

Starting from scratch

Matthieu Brouillard edited this page Dec 13, 2016 · 1 revision

It is very easy to start using jgitver-maven-plugin on a new maven project:

  1. let's start with a new maven project

    mvn archetype:generate -B \
      -DarchetypeCatalog=internal \
      -DarchetypeGroupId=org.apache.maven.archetypes \
      -DarchetypeArtifactId=maven-archetype-quickstart \
      -DarchetypeVersion=1.1 \
      -DgroupId=fr.brouillard.jgitver.demos \
      -DartifactId=demo1 \
      -Dpackage=fr.brouillard.jgitver.demos \
      -Dversion=0
    
  2. go to the created project directory

    cd demo1
    
  3. create maven extension file to use jgitver-maven-plugin

    this step just consists in creating a .mvn directory whith an extensions.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 -)"
    
  4. initialize git on this project

    git init
    git add .
    git commit -m "inital commit"
    
  5. et voilà you're ready to use jgitver inside your maven project

    mvn validate
    [INFO] Scanning for projects...
    [INFO] jgitver-maven-plugin is about to change project(s) version(s)
    [INFO]     fr.brouillard.jgitver.demos::demo1::0 -> 0.0.0-SNAPSHOT
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building demo1 0.0.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.639 s
    [INFO] Finished at: 2016-12-13T20:05:18+01:00
    [INFO] Final Memory: 10M/293M
    [INFO] ------------------------------------------------------------------------