Maven Snapshots - Maven

What are Maven Snapshots?

A common practice is that a large software application includes multiple modules and a large teams are working on different modules of same application. Let’s consider a team is working on the front end of the application as app-ui project (app-ui.jar:1.0) and they are using data-service project (data-service.jar:1.0).
Incase if a team is working on data-service is undergoing bug fixing or enhancements at rapid pace and they are releasing the library to remote repository almost every other day.
If a data-service team uploads a new version every other day, then following problems will arise −
  • data-service team should tell app-ui team every time when they have released an updated code.
  • app-ui team required to update their pom.xml regularly to get the updated version.
To handle such kind of situation, SNAPSHOT concept comes into play.

What is SNAPSHOT?

SNAPSHOT is designed as a special version which presents a current development copy. Here Maven always checks for a new SNAPSHOT version in a remote repository for every build.
While data-service teams always works on to release SNAPSHOT of its updated code every time to repository, say data-service: 1.0-SNAPSHOT, replacing an older SNAPSHOT jar.

Snapshot vs Version

In the scenario of Version, if Maven once downloaded the mentioned version, say data-service:1.0, then it will never try to download a newer 1.0 available in repository. You need to be upgraded to 1.1 to download the updated code.
While in this scenario of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-SNAPSHOT) every time app-ui team build their project.

app-ui pom.xml

app-ui project is using 1.0-SNAPSHOT of data-service.

data-service pom.xml

Now data-service project is releasing 1.0-SNAPSHOT for every minor change.
Here Maven automatically adds the latest SNAPSHOT regularly so that ,you can push maven to download latest snapshot build using -U switch to any maven command.
Now open the command console, go to the C:\ > MVN > app-ui directory and execute the following mvn command.
Let’s start building the project after downloading the latest SNAPSHOT of data-service.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Maven Topics