A snapshot is a artifact that has not been released.
The difference between a release version and a snapshot version is that snapshots might get updates.
The snapshot property of a artifact is defined in its version. See syntax.
The -SNAPSHOT version is replaced by a the deployment/upload date/timestamp and an enumerator
A snapshot version in Maven is one that has not been released. -SNAPSHOT is a reserved string used to identify versions that are currently in development.
A snapshot version is:
- the latest build.
- a version that has not been released.
<version> description-SNAPSHOT </version>
- description can be any description you want such as master or 1.0
With this pattern, Maven will know that this version is not stable and is subject to changes.
mvn clean install -U
- -U means force update of snapshot dependencies.
When you build an application, Maven will search Snapshot version dependencies once a day
Maven provides you a way to can change this update policy in the settings.xml 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.
Failure to find snapshot artifact, resolution will not be reattempted until
Failure to find artifact in repo was cached in the local repository, resolution will not be reattempted until the update interval of repo has elapsed or updates are forced