05: Git & Maven for releasing software artifacts Q&A

Q1. What are the general steps involved in making a software release?

#1: Checking out the software artifacts to you build serevr or local box from a source control management (i.e. SCM) system.

#2: Giving it a version so it can be uniquely identifieds

#3: Building, testing and packaging the artifacts.

#4: Deploying the built artifacts a repository like Nexus where the artifacts can be picked up for for actual roll out on target servers by the release team.

#5: Tagging this state in SCM so it can be associated with the matching artifacts.

Q2. How will you go about using Git and Maven to perform software releases?

Step #1: Checking the software out from Git and checkout if you want to release from a branch

Step #2: Giving it a version. “0.0.1-SNAPSHOT” in pom.xml becomes “0.0.2-RC1” (that is Release Candidate 1)

You should not have any “SNAPSHOT” in your multi-module pom files.

If you find any “SNAPSHOT”, manually update them with something like

Step #3: Building, testing, packaging and deploying it to an artifact repository like Nexus.

You need to have the path to the Nexus configured in your pom.xml with “distributionManagement”

and the Maven settings.xml configured with user/password to connect to the Nexus repo

Step #4: Tagging this state in SCM.

You need to have the “SCM” configured in your pom.xml file

Step #5 Advance with the maven pom.xml tags to 0.0.3-SNAPSHOT to continue with the development work.

Note: in your pom.xml file

if you have set the “generateBackupPoms” to “true” then you need to run “mvn versions:commit” or “mvn versions:rollback”.

The “scm” plugin needs the following config in the pom.xml file

The “versions” and “scm” plugins give you better control in releasing your software artifacts. There is another approach where Maven does most of the hard work for you if your release is very straight forward. This is with the help of the maven “release” plugin. In the pom.xml file you need to have

and then use it in the command-line as:

You may also like: Git source control Q&A | 12 Maven interview Questions & Answers | 7 More Maven interview Questions & Answers

300+ Java & Big Data Interview FAQs

16+ Java Key Areas Interview Q&As

800+ Java Interview Q&As

300+ Java & Big Data Tutorials