I am a bit confused about the meaning of a Maven Snapshot and why we build one?
15 Answers
A snapshot version in Maven is one that has not been released.
The idea is that before a 1.0
release (or any other release) is done, there exists a 1.0-SNAPSHOT
. That version is what might become 1.0
. It's basically "1.0
under development". This might be close to a real 1.0
release, or pretty far (right after the 0.9
release, for example).
The difference between a "real" version and a snapshot version is that snapshots might get updates. That means that downloading 1.0-SNAPSHOT
today might give a different file than downloading it yesterday or tomorrow.
Usually, snapshot dependencies should only exist during development and no released version (i.e. no non-snapshot) should have a dependency on a snapshot version.

- 1,222
- 2
- 13
- 17

- 302,674
- 57
- 556
- 614
-
So the snapshot is always a stabler build, I assume. And that build number pertains only to which version of artifacts to use and not a different branch of the source code, is that correct? – amphibient Oct 08 '13 at 21:54
-
77@amphibient: No, the snapshot is _not_ necessarily more stable: it is just the latest build. The snapshot _precedes_ the actual release, it does not come after it. Indeed, version numbers typically do not refer to branches. – avandeursen Mar 23 '14 at 21:05
-
10@avandeursen snapshots don't necessarily have the semantics you claim. You can have "master-SNAPSHOT" and later make a 1.0 release. it does not have to be "FutureVersion-SNAPSHOT", nor necessarily ever precede a release. Everything else is right though -- it is an unstable reference to a moving target and can not be relied upon to produce a repeatable build. – Scott Carey May 07 '15 at 23:18
-
3Thanks @ScottCarey. "Commonly precedes" would probably be more accurate indeed, as there is not even a guarantee that the "moving target" will eventually exist. – avandeursen May 08 '15 at 07:59
-
Can we have versions like x.x.x-SNAPSHOT-1, x.x.x-SNAPSHOT-2. Is this valid SNAPSHOT version? I asked coz we want to tag the code with many snapshots. – Jay Oct 11 '17 at 10:02
-
2@Jay: no, as far as I know there is no way to explicitly reference a specific SNAPSHOT, they are non-addressable/interchangable by design. If you need fine-grained versioning, then you should just release release candidates with specific version strings (-RC1, -RC2 or something like that). – Joachim Sauer Oct 11 '17 at 10:12
-
83Why can't they just call it "`1.0-DEVELOPMENT`", or like "`1.0-INPROGRESS`", why do people have to use non-obvious terms – uh_big_mike_boi Aug 14 '19 at 00:59
-
@uh_big_mike_boi yeah totally agree. Or even something like `1.0-PRE-RELEASE` or `1.0-RC` – Rei Mavronicolas Apr 30 '20 at 19:44
-
For other languages we use 1.0-RC1 that means release candidate – LuisComS Jun 25 '20 at 20:26
-
4@LuisComS: A RC is not the same as a snapshot. A RC is a *specific* version prior to a release. `-SNAPSHOT` suggests "the latest built version" which can change. I.e. downloading `1.0-SNAPSHOT` today may give you a different binary than `1.0-SNAPSHOT` tomorrow. – Joachim Sauer Jun 25 '20 at 20:52
-
8Am I the only one who thinks everything in the Java stack has weird names as if they were developed by weirdos? The word snapshot does not even remotely relate to the concept it is being used for. Almost everything in Java world has got utter rubbish nonsense names. Totally with on this @uh_big_mike_boi – Sнаđошƒаӽ Feb 21 '21 at 10:15
-
14@Sнаđошƒаӽ: I'm not quite sure what you're trying to accomplish with this this rant. SNAPSHOT comes from the fact that it's a "snapshot" of the state of a project during continuous development. There might be a better name, but it's not entirely pointless. – Joachim Sauer Feb 21 '21 at 16:04
-
Along with the actual answer, I want to add another point in order to considate the answer: Unlike regular versions, Maven checks for a new SNAPSHOT version in a remote repository for every build (ref: tutorialspoint) – Abhishek Chatterjee Mar 07 '21 at 12:30
-
@AbhishekChatterjee: comments are not for answers (or answer-fragements). The answer by Romain has a good explanation of the update frequency of SNAPSHOT versions, which is why I keep this answer to the bare minimum. – Joachim Sauer Mar 07 '21 at 13:44
-
Maven will treat 1.0-SNAPSHOT as being lower than 1.0, so it does precede the foo in foo-SNAPSHOT in theory, but yes the foo can be whatever, doesn't need to be version numbers. – Didier A. Mar 25 '21 at 05:12
-
After doing a feature freeze, e.g. when the "trunk" moves from 1.0-SNAPSHOT to 2.0-SNAPSHOT, is it ok or not recommended to do the QA on the 1.0-SNAPSHOT? (should QA instead use a 1.0-RC1 branch?) (reason #1: checking that there are no own or third party snapshot dependencies is much easier) – mjn May 26 '23 at 06:44
The three others answers provide you a good vision of what a -SNAPSHOT
version is. I just wanted to add some information regarding the behavior of Maven when it finds a SNAPSHOT
dependency.
When you build an application, Maven will search for dependencies in the local repository. If a stable version is not found there, it will search the remote repositories (defined in settings.xml
or pom.xml
) to retrieve this dependency. Then, it will copy it into the local repository, to make it available for the next builds.
For example, a foo-1.0.jar
library is considered as a stable version, and if Maven finds it in the local repository, it will use this one for the current build.
Now, if you need a foo-1.0-SNAPSHOT.jar
library, Maven will know that this version is not stable and is subject to changes. That's why Maven will try to find a newer version in the remote repositories, even if a version of this library is found on the local repository. However, this check is made only once per day. That means that if you have a foo-1.0-20110506.110000-1.jar
(i.e. this library has been generated on 2011/05/06 at 11:00:00) in your local repository, and if you run the Maven build again the same day, Maven will not check the repositories for a newer version.
Maven provides you a way to change this update policy in your repository definition:
<repository>
<id>foo-repository</id>
<url>...</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>XXX</updatePolicy>
</snapshots>
</repository>
where XXX
can be:
- always: Maven will check for a newer version on every build;
- daily, the default value;
- interval:XXX: an interval in minutes (XXX)
- never: Maven will never try to retrieve another version. It will do that only if it doesn't exist locally. With the configuration,
SNAPSHOT
version will be handled as the stable libraries.
(model of the settings.xml can be found here)

- 8,532
- 14
- 49
- 67

- 79,475
- 49
- 202
- 273
-
3It seems it is possible to use command line switch to force maven redownload all the `SNAPSHOT` versions: `mvn clean package -U` as per [maven tutorial](http://www.tutorialspoint.com/maven/maven_snapshots.htm) – Dimitry K Mar 25 '14 at 14:38
-
3Careful with the `-U` flag. It might not do what you expect due to [MNG-4142](http://jira.codehaus.org/browse/MNG-4142). – Kevin Cross May 05 '14 at 18:16
-
4Also worth mentioning that good practice requires you use no snapshot dependencies when you come to create a release version, and indeed the Maven Release Plugin will fail if there are snapshot dependencies present. – RCross Jul 07 '14 at 08:29
-
2I ran `mvn install` to install a jar of version 1.0-SNAPSHOT into my local repo. The next day I made changes to the project but did not change the version -- then when running `mvn install` it didn't seem to change it in my local repo. Is that expected behavior? Can I not re-use a version and overwrite it with `mvn install` after making changes to it? – Don Cheadle Nov 26 '14 at 16:56
-
1@mmcrae AFAIK it should be updated. Thats what *install* goal do, updating local SNAPSHOT jars. Have you discovered something else? – Johnny Oct 27 '16 at 07:30
The "SNAPSHOT" term means that the build is a snapshot of your code at a given time.
It usually means that this version is still under heavy development.
When the code is ready and it is time to release it, you will want to change the version listed in the POM. Then instead of having a "SNAPSHOT" you would use a label like "1.0".
For some help with versioning, check out the Semantic Versioning specification.

- 61
- 1
- 8

- 136,852
- 53
- 295
- 323
-
1In terms of **semantic versioning**, a -SNAPSHOT release would be a pre-release: "_A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92._" – avandeursen Mar 23 '14 at 21:15
-
3It sounds to me like "SNAPSHOT" is not a "snapshot of your code at a specific time" but rather "the latest build of the code available." If this were HTTP, it would be the flag that says, "Don't bother doing a HEAD, go get whatever is on the server anyway." Indeed, it's almost the opposite "code at a given time." – lilbyrdie May 21 '15 at 14:52
-
1
-
1@Joker "heavy" is when lot of things are changing (new features, refactoring etc.) – robert May 03 '20 at 18:27
-
I was recently reading an article about the git workflow (https://sandofsky.com/workflow/git-workflow/) and the author is using the term "checkpoint commits". Well, this "checkpoint" is just another name for what the Maven team called "snapshot". One could of course easily argue "Why are they called checkpoint???" :) – Sorin Postelnicu Sep 21 '21 at 14:24
A "release" is the final build for a version which does not change.
A "snapshot" is a build which can be replaced by another build which has the same name. It implies that the build could change at any time and is still under active development.
You have different artifacts for different builds based on the same code. E.g. you might have one with debugging and one without. One for Java 5.0 and one for Java 6. Generally its simpler to have one build which does everything you need. ;)

- 857
- 9
- 31

- 525,659
- 79
- 751
- 1,130
Maven versions can contain a string literal "SNAPSHOT" to signify that a project is currently under active development.
For example, if your project has a version of “1.0-SNAPSHOT” and you deploy this project’s artifacts to a Maven repository, Maven would expand this version to “1.0-20080207-230803-1” if you were to deploy a release at 11:08 PM on February 7th, 2008 UTC. In other words, when you deploy a snapshot, you are not making a release of a software component; you are releasing a snapshot of a component at a specific time.
So mainly snapshot versions are used for projects under active development. If your project depends on a software component that is under active development, you can depend on a snapshot release, and Maven will periodically attempt to download the latest snapshot from a repository when you run a build. Similarly, if the next release of your system is going to have a version “1.8,” your project would have a “1.8-SNAPSHOT” version until it was formally released.
For example , the following dependency would always download the latest 1.8 development JAR of spring:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>1.8-SNAPSHOT”</version>
</dependency>
An example of maven release process

- 10,528
- 6
- 54
- 53
I'd like to make a point about terminology. The other answers gave good explanations about what a "snapshot" version is in the context of Maven. But does it follow that a non-snapshot version should be termed a "release" version?
There is some tension between the semantic versioning idea of a "release" version, which would seem to be any version that does not have a qualifier such as -SNAPSHOT
but also does not have a qualifier such as -beta.4
; and Maven's idea idea of a "release" version, which only seems to include the absence of -SNAPSHOT
.
In other words, there is a semantic ambiguity of whether "release" means "we can release it to Maven Central" or "the software is in its final release to the public". We could consider -beta.4
to be a "release" version if we release it to the public, but it's not a "final release". Semantic versioning clearly says that something like -beta.4
is a "pre-release" version, so it wouldn't make sense for it to be called a "release" version, even without -SNAPSHOT
. In fact by definition even -rc.5
is a release candidate, not an actual release, even though we may allow public access for testing.
So Maven notwithstanding, in my opinion it seems more appropriate only to call a "release" version one that doesn't have any qualifier at all, not even -beta.4
. Perhaps a better name for a Maven non-snapshot version would be a "stable" version (inspired by another answer). Thus we would have:
1.2.3-beta.4-SNAPSHOT
: A snapshot version of a pre-release version.1.2.3-SNAPSHOT
: A snapshot version of a release version.1.2.3-beta.4
: A stable version of a pre-release version.1.2.3
: A release version (which is a stable, non-snapshot version, obviously).

- 18,219
- 30
- 144
- 272
-
Do you have any info about how does maven deal with build metadata or pre-release naming conventions? I mean, we all know that alfa preceeds beta, but does maven know? Even if it takes 1.2.3-beta.4 as a stable release, does it at least know that 1.2.3 is AFTER it? – DGoiko Oct 28 '19 at 20:43
-
1SNAPSHOT means that the Jar content can change as you depend on it. So someone could delete a class from it, push it to the repo, and now your code would break, even though it depends on the same version 1.0-SNAPSHOT. Every other version (all those without the suffix -SNAPSHOT) should be stable in the sense that once you publish it to the repo, what it contains is what it contains and you won't change it anymore, if you change anything it'll be under a new version. – Didier A. Mar 25 '21 at 05:17
usually in maven we have two types of builds 1)Snapshot builds 2)Release builds
snapshot builds:SNAPSHOT is the special version that indicate current deployment copy not like a regular version, maven checks the version for every build in the remote repository so the snapshot builds are nothing but development builds.
Release builds:Release means removing the SNAPSHOT at the version for the build, these are the regular build versions.

- 1,175
- 10
- 6
A Maven SNAPSHOT is an artifact created by a Maven build and pretends to help developers in the software development cycle. A SNAPSHOT is an artifact (or project build result ) that is not pretended to be used anywhere, it's only a temporarily .jar, ear, ... created to test the build process or to test new requirements that are not yet ready to go to a production environment. After you are happy with the SNAPSHOT artifact quality, you can create a RELEASE artifact that can be used by other projects or can be deployed itself.
In your project, you can define a SNAPSHOT using the version element in the pom.xml file of Maven:
<groupId>example.project.maven</groupId>
<artifactId>MavenEclipseExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>Maven pom example</description>
If you want to understand better Maven you can look into these articles too:

- 129
- 1
- 5
-
1"pretend" is a pretty harsh word when snapshots are a legitimate part of a development cycle (see anything that Spring Framework does, from its nightly builds to it's release candidacy strategies) – Blake Neal Dec 07 '20 at 20:05
-
8@BlakeNeal It's possible that the user tagus is not a native English speaker (possibly he is a native Spanish speaker) and he incorrectly used the word "pretend" when he actually wanted to say "aims to help developers": one of the possible meanings of the word "pretender" in Spanish is "to aim": https://translate.google.com/?sl=en&tl=es&text=aim&op=translate – Sorin Postelnicu Mar 24 '21 at 10:39
This is how a snapshot looks like for a repository and in this case is not enabled, which means that the repository referred in here is stable and there's no need for updates.
<project>
...
<repositories>
<repository>
<id>lds-main</id>
<name>LDS Main Repo</name>
<url>http://code.lds.org/nexus/content/groups/main-repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
Another case would be for:
<snapshots>
<enabled>true</enabled>
</snapshots>
which means that Maven will look for updates for this repository. You can also specify an interval for the updates with tag.

- 498
- 5
- 8
simply snapshot means it is the version which is not stable one.
when version includes snapshot like 1.0.0 -SNAPSHOT means it is not stable version and look for remote repository to resolve dependencies

- 59
- 3
Snapshot simply means depending on your configuration Maven will check latest changes on a special dependency. Snapshot is unstable because it is under development but if on a special project needs to has a latest changes you must configure your dependency version to snapshot version. This scenario occurs in big organizations with multiple products that these products related to each other very closely.

- 31
- 2
understanding the context of SDLC will help understand the difference between snapshot and the release. During the dev process developers all contribute their features to a baseline branch. At some point the lead thinks enough features have accumulated then he will cut a release branch from the baseline branch. Any builds prior to this time point are snapshots. Builds post to this point are releases. Be noted, release builds could change too before going to production if any defect spot during the release testing.

- 388
- 7
- 17
As the name suggests, snapshot refers to a state of project and its dependencies at that moment of time. Whenever maven finds a newer SNAPSHOT of the project, it downloads and replaces the older .jar file of the project in the local repository.
Snapshot versions are used for projects under active development. If your project depends on a software component that is under active development, you can depend on a snapshot release, and Maven will periodically attempt to download the latest snapshot from a repository when you run a build.

- 301
- 3
- 3
In development phase Maven snapshots everyday looks for newer higher version if available in nexus repository n download it locally for next build.
Four option you can set in respository defination
Always, Daily (default), Interval, Never,
Note: In production release we should not have dependency on snapshot version.

- 301
- 2
- 4
The SNAPSHOT value refers to the 'latest' code along a development branch and provides no guarantee the code is stable or unchanging. Conversely, the code in a 'release' version (any version value without the suffix SNAPSHOT) is unchanging.
In other words, a SNAPSHOT version is the 'development' version before the final 'release' version. The SNAPSHOT is "older" than its release.
During the release process, a version of x.y-SNAPSHOT changes to x.y. The release process also increments the development version to x.(y+1)-SNAPSHOT. For example, version 1.0-SNAPSHOT is released as version 1.0, and the new development version is version 1.1-SNAPSHOT.

- 171
- 1
- 13