Question
I am confused about what a Maven SNAPSHOT version means and why developers create one. What exactly is a SNAPSHOT in Maven, how does it differ from a regular release version, and why is it useful during development?
Short Answer
By the end of this page, you will understand what a Maven SNAPSHOT is, how Maven treats it differently from a release version, and why teams use snapshots while software is still changing. You will also see how snapshots appear in pom.xml, how dependency updates work, and when to use a snapshot versus a stable release.
Concept
In Maven, a SNAPSHOT is a development version of a project.
If a project version ends with -SNAPSHOT, it tells Maven:
- this version is still under active development
- it may change over time
- Maven may need to check for newer builds of the same version
For example:
<version>1.0-SNAPSHOT</version>
This does not mean a completely different version number each time. Instead, it means:
- the project is currently working toward version
1.0 - but that version is not final yet
- new builds can replace older snapshot builds
A release version is different:
<version>1.0</version>
A release is expected to be stable and permanent. Once published, it should not change.
Why snapshots matter
During development, teams often need to share unfinished work between modules or services.
Example:
- Team A is building a shared Java library
- Team B depends on that library
- Team A has not released
2.0yet - Team B still wants to test the latest in-progress changes
A snapshot solves this problem. Team A can publish 2.0-SNAPSHOT, and Team B can depend on it before the final release exists.
Mental Model
Think of a Maven SNAPSHOT like a draft document.
- A release version is like a signed final PDF: once sent, it should never change.
- A snapshot version is like a shared Google Doc draft: people can keep updating it while others review the latest state.
If your dependency is a release, you expect the exact same content every time.
If your dependency is a snapshot, you are saying: "Give me the current in-progress build of this version line."
That is why snapshots are useful in active development but risky for long-term stability.
Syntax and Examples
The most common place you see a snapshot is in a Maven pom.xml file.
Declaring your project as a snapshot
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo-lib</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
This means your project is currently being developed toward version 1.0.
Using a snapshot dependency
<dependency>
<groupId>com.example</groupId>
<artifactId>demo-lib</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Step by Step Execution
Consider this dependency:
<dependency>
<groupId>com.example</groupId>
<artifactId>demo-lib</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
Now imagine the library team publishes snapshot builds during the day.
Step-by-step
- The library project is marked as version
1.2-SNAPSHOT. - A developer runs a build and deploys it to the snapshot repository.
- The repository stores it as a timestamped build, such as:
1.2-20240610.090100-1
- Your project depends on
1.2-SNAPSHOT. - Maven checks whether a newer snapshot is available, depending on update policy.
- Later, the library team deploys another snapshot build:
1.2-20240610.150500-2
- On a future build, Maven may download the newer snapshot.
- When development is complete, the team releases
1.2. - Projects should then move from
1.2-SNAPSHOTto .
Real World Use Cases
Here are common situations where Maven snapshots are useful.
Shared internal libraries
A company has a common utility library used by several applications. While the library is still being updated, applications can depend on 3.0-SNAPSHOT and test the newest changes before the final release.
Multi-module development across teams
One team works on an API client, while another team builds a service that uses it. Snapshot versions allow both teams to integrate continuously instead of waiting for a formal release.
CI/CD pipelines for ongoing work
A continuous integration pipeline builds and publishes snapshot artifacts after each merge to a development branch. Other projects can test against the latest working build.
Testing breaking changes safely
Before releasing a major version, teams may publish a snapshot so consumers can try the new API and report issues early.
Plugin and framework development
When building a Maven plugin, Spring starter, or shared backend component, snapshots help downstream projects test in-progress functionality without requiring a final release every day.
Real Codebase Usage
In real projects, snapshots are usually part of a wider development workflow.
Common patterns
Internal dependency sharing
Teams publish snapshots to an internal artifact repository such as Nexus or Artifactory so other projects can consume the latest development build.
Early integration testing
A service may depend on payment-sdk:2.1-SNAPSHOT while the SDK team is still implementing a feature. This helps catch integration issues early.
CI-generated snapshot builds
A build server automatically deploys snapshot artifacts for non-release branches or the main development branch.
Guarding production stability
Many teams avoid snapshot dependencies in production builds because they want reproducible, stable deployments.
Release promotion workflow
A typical flow looks like this:
- Develop with
-SNAPSHOT - Test and stabilize
- Release a fixed version like
2.1 - Move next development cycle to
2.2-SNAPSHOT
Related development practices
- Validation: ensure dependencies point to approved repositories
- Early return mindset: stop a release build if any snapshot dependencies remain
- Configuration separation: allow snapshots in development environments but not in production
- Error handling: pin exact release versions when reproducibility matters
Common Mistakes
Beginners often misunderstand what snapshots are for.
Mistake 1: Treating a snapshot like a stable release
Broken assumption:
<version>1.0-SNAPSHOT</version>
A beginner may think this is fixed forever. It is not. New builds of the same snapshot can appear.
How to avoid it
Use a release version for stable builds:
<version>1.0</version>
Mistake 2: Using snapshots in production without care
If production depends on a snapshot, the build may behave differently later when a newer snapshot is downloaded.
How to avoid it
Prefer release versions for production deployments and reproducible builds.
Mistake 3: Forgetting repository settings
A snapshot dependency may fail if only release repositories are configured.
Broken example:
<repositories>
<repository>
<id>company-releases</id>
<url>https://repo.example.com/releases
true
false
Comparisons
| Concept | Snapshot version | Release version |
|---|---|---|
| Example | 1.0-SNAPSHOT | 1.0 |
| Stability | In development | Final/stable |
| Can change over time | Yes | No |
| Repository behavior | May resolve to newer timestamped builds | Fixed artifact |
| Best use | Development and integration testing | Production and stable dependencies |
| Reproducibility | Lower unless controlled carefully | High |
Snapshot vs local install
| Concept |
|---|
Cheat Sheet
Quick reference
Snapshot version syntax
<version>1.0-SNAPSHOT</version>
Release version syntax
<version>1.0</version>
Key rules
-SNAPSHOTmeans the version is still under development.- Snapshot artifacts can be updated over time.
- Release artifacts should never change once published.
- Maven may resolve snapshots to timestamped builds in remote repositories.
- Snapshots are commonly stored in separate snapshot repositories.
- Releases are preferred for production and reproducible builds.
Typical workflow
- Start development with
1.0-SNAPSHOT - Publish snapshot builds during development
- Release final version as
1.0 - Move next development cycle to
1.1-SNAPSHOT
Good practice
- Use snapshots for active collaboration
- Use releases for stable environments
- Avoid long-term production dependence on snapshots
- Make sure snapshot repositories are configured when needed
Common commands
FAQ
What does SNAPSHOT mean in Maven?
It means the version is still being developed and is not a final release yet.
Why does Maven use snapshots?
Snapshots let teams share and test in-progress code without creating a new final version for every change.
Can a Maven snapshot change over time?
Yes. That is the main idea of a snapshot. New builds of the same snapshot version can replace older ones in repository resolution.
Is 1.0-SNAPSHOT the same as 1.0?
No. 1.0-SNAPSHOT is a development version. 1.0 is a final release version.
Should I use snapshot dependencies in production?
Usually no. Release versions are safer because they are stable and reproducible.
Why does Maven store timestamped snapshot files?
It helps repositories track the actual builds behind a logical snapshot version such as 1.0-SNAPSHOT.
What is the difference between mvn install and a snapshot deploy?
mvn install stores the artifact only on your local machine. A snapshot deploy publishes it to a shared repository for others to use.
Mini Project
Description
Create a simple two-project setup to understand how a snapshot is used in practice. One project will act as a shared Java library, and the second project will depend on it using a Maven snapshot version. This demonstrates how unfinished code can be shared during development before a final release is published.
Goal
Build and use a small Maven library as a -SNAPSHOT dependency from another project.
Requirements
- Create a Maven library project with version
1.0-SNAPSHOT - Add a simple Java class and method to the library
- Install or deploy the snapshot so another project can use it
- Create a second Maven project that depends on the snapshot library
- Run the second project and confirm it uses the library method
Keep learning
Related questions
Avoiding Java Code in JSP with JSP 2: EL and JSTL Explained
Learn how to avoid Java scriptlets in JSP 2 using Expression Language and JSTL, with examples, best practices, and common mistakes.
Choosing a @NotNull Annotation in Java: Validation vs Static Analysis
Learn how Java @NotNull annotations differ, when to use each one, and how to choose between validation, IDE hints, and static analysis tools.
Convert a Java Stack Trace to a String
Learn how to convert a Java exception stack trace to a string using StringWriter and PrintWriter, with examples and common mistakes.