Quick revision
The short answer
A SNAPSHOT version, such as 1.4.0-SNAPSHOT, is mutable: the repository can hand out a newer build under the same version at any time. A release version, such as 1.4.0, is immutable once published. A production build that depends on a SNAPSHOT is therefore not reproducible and can change without any change to our code, so the release process should fail if SNAPSHOT dependencies remain, which the Maven Enforcer rule requireReleaseDeps does.
What to remember
In this answer, we saw that a SNAPSHOT version is mutable: the repository stores timestamped builds and hands out the newest one under the same version, while a release version is immutable once published. Production builds with SNAPSHOT dependencies are therefore not reproducible and can change without code changes, so the release process should fail if any remain, which the Enforcer rule requireReleaseDeps does.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A SNAPSHOT version, such as 1.4.0-SNAPSHOT, is mutable: the repository can hand out a newer build under the same version at any time. A release version, such as 1.4.0, is immutable once published. A production build that depends on a SNAPSHOT is therefore not reproducible and can change without any change to our code, so the release process should fail if SNAPSHOT dependencies remain, which the Maven Enforcer rule requireReleaseDeps does.
Why this question is asked
Version numbers look like a formality until a production incident happens and nobody can say which code was actually running. SNAPSHOT dependencies are a classic cause: the same pom.xml, built twice a day apart, can produce two different applications. Interviewers ask this question to check that we understand what Maven promises for each kind of version and how to protect a release. In this answer, we will recap how Maven versions work, see how a SNAPSHOT is resolved, reproduce the problem, and then stop it with the Enforcer plugin.
1A Quick Recap of Maven Versions
Every Maven artifact is identified by its coordinates: groupId, artifactId and version. When we declare a dependency, Maven looks up those coordinates in our local repository, the folder under ~/.m2/repository, and in remote repositories such as Maven Central or the company's Nexus or Artifactory.
Maven treats one kind of version specially: any version ending in -SNAPSHOT. It means a version that is still under development. Everything else, such as 1.4.0 or 2.0.0-RC1, is a release version. Repositories are usually split the same way, into a snapshot repository and a release repository with different rules.
2How a SNAPSHOT Is Resolved
When a library team runs mvn deploy on version 1.4.0-SNAPSHOT, the remote repository does not overwrite a single file. It stores the build with a timestamp and a build number, such as 1.4.0-20261105.101500-3, and updates a metadata file that says which of these is the latest. When our build asks for 1.4.0-SNAPSHOT, Maven reads that metadata and downloads the newest timestamped build.
Maven also checks for updates periodically. By default it checks a remote snapshot repository once a day, controlled by the updatePolicy setting, and -U forces a check on every build. So two builds of our application, from exactly the same commit, can receive different library code depending on when they ran and what was in the local cache.
6 messages in order. Play them, or step through them one at a time.
The pom did not change, but the artifact did.
Notice that the version in our pom never changed. The mutable part is hidden in the repository, which is exactly why this kind of change is so hard to notice.
3Release Versions Are Immutable
A release version is published once and never changes. Maven Central refuses to overwrite a released artifact, and a properly configured company repository does the same, with redeploy disabled for the release repository. Maven also caches release artifacts in the local repository and never checks for updates, because by definition there is nothing to update. So 1.4.0 means the same bytes today and in five years.
That immutability is what makes a build reproducible: given the same commit and the same release dependencies, we get the same application. It also makes incidents traceable, because the version of each library in a production artifact tells us exactly which code it contains.
4Why Production Must Never Depend on a SNAPSHOT
Put together, a production artifact built against a SNAPSHOT has three problems. It is not reproducible: rebuilding the same tag later may produce different code, so we cannot reliably rebuild a hotfix from an old release. It can change without a code change in our repository, so a new deployment can carry a library change nobody reviewed for this service. And it is not traceable: the version string does not tell us which build of the library is inside, so debugging an incident means digging through timestamps.
SNAPSHOTs are excellent for what they were designed for: development between teams, where we want the latest changes of a library we are working on together. The rule is simply that they stop at the release boundary.
5Failing the Release on SNAPSHOT Dependencies
The rule needs to be automatic, because a forgotten SNAPSHOT is easy to miss in review. The maven-enforcer-plugin has a built-in rule, requireReleaseDeps, that fails the build if any dependency is a SNAPSHOT. We bind it in a release profile, or in the pipeline that builds release artifacts, so development builds still work with SNAPSHOTs.
The exact output format varies by Enforcer version, but the build fails and names the offending dependency. The maven-release-plugin also refuses to prepare a release while SNAPSHOT dependencies remain, and a related Enforcer rule, requireReleaseVersion, checks that our own project version is not a SNAPSHOT. SNAPSHOT plugins are just as dangerous as dependencies, and the Enforcer has a rule for those too, requirePluginVersions, which also requires every plugin version to be pinned.
6Follow-up questions
What does mvn -U do?
It forces Maven to check remote repositories for updated SNAPSHOTs and missing releases on this build, ignoring the update policy. It is useful when we know a new SNAPSHOT was deployed, but it is another sign that SNAPSHOT builds depend on timing.
Can we pin a specific SNAPSHOT build?
Yes, by declaring the timestamped version, such as 1.4.0-20261102.081200-7, as the dependency version. That makes it stable, but snapshot repositories usually delete old timestamped builds, so the build may break later. Asking the library team for a real release is the proper fix.
Are version ranges like [1.4,2.0) a similar risk?
Yes. A range lets Maven pick a newer release whenever one appears, so the build changes without a code change, just as with SNAPSHOTs. For applications, pin exact versions and let a dependency bot propose upgrades as reviewed pull requests.
7Conclusion
In this answer, we saw that a SNAPSHOT version is mutable: the repository stores timestamped builds and hands out the newest one under the same version, while a release version is immutable once published. Production builds with SNAPSHOT dependencies are therefore not reproducible and can change without code changes, so the release process should fail if any remain, which the Enforcer rule requireReleaseDeps does.
Open with
A SNAPSHOT version, anything ending in dash SNAPSHOT, means work in progress, and it is mutable. When a team deploys 1.4.0-SNAPSHOT, the repository stores a timestamped build and updates its metadata, so the next time someone resolves 1.4.0-SNAPSHOT they get the newest build, and Maven checks for updates by default once a day.
Then, if they want more
A release version like 1.4.0 is immutable: it is published once, repositories refuse to overwrite it, and Maven never checks it for updates. That is why production should never use a SNAPSHOT dependency. The build is not reproducible, because building the same tag again later can pull different library code.
It can change without any change in our repository, so a deployment can carry library changes nobody reviewed for our service. And the version string does not tell us which code is inside, which makes incidents harder to trace. SNAPSHOTs are fine during development between teams, but they must stop at the release boundary.
I enforce that automatically with the maven-enforcer-plugin and its requireReleaseDeps rule in the release profile or pipeline, so the build fails and names the SNAPSHOT dependency; the release plugin also refuses to release with SNAPSHOT dependencies.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Maven guides, Gradle user manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What do SNAPSHOT and release versions mean in Maven, and why should a production...": https://scrivio-interview-library.netlify.app/java/version-control-and-ci/077639e382/