What is a SNAPSHOT version and how is it different from a release version?
Short answer
A SNAPSHOT (for example 2.1.0-SNAPSHOT) is a development version that keeps changing — each build can replace it in the repository. A release (2.1.0) is a fixed version that never changes once published. Nexus usually keeps them in separate repositories: maven-snapshots and maven-releases.
How it works
- When you
mvn deploya SNAPSHOT, Nexus stores it with a timestamp (2.1.0-20261126.101530-7.jar) and2.1.0-SNAPSHOTalways points to the latest. - Other projects depending on a SNAPSHOT automatically get the newest one on their next build.
- A release repository is usually configured to refuse redeploying the same version.
Why it matters
| SNAPSHOT | Release | |
|---|---|---|
| Changes over time? | Yes | Never |
| Repeatable build? | No | Yes |
| Use for | Daily dev builds, integration branches | Anything that goes to staging/production |
Real-world example
A team's main branch builds orders-2.1.0-SNAPSHOT on every merge. When they cut a release, the pipeline (or the Maven release plugin) changes the version to 2.1.0, builds, tags Git v2.1.0, deploys to maven-releases, then bumps main to 2.2.0-SNAPSHOT.
What to say in the interview
"SNAPSHOT is a mutable development version; release is immutable. We never deploy SNAPSHOTs to production because the same version name could contain different code. Releases go to a separate Nexus repository that blocks redeployment."