Snapshots in Maven

 

In Maven, a snapshot refers to a development version of a project. It indicates that the version is still under development and not yet stable or final.


What Is a Snapshot?

A snapshot is a special version of a project that changes frequently. It is typically used during development before a stable release is made.



Snapshot Version Example:

<version>1.0-SNAPSHOT</version>

Here, 1.0-SNAPSHOT means it is a work-in-progress version of 1.0.



Where Are Snapshots Stored?

Maven uses separate repositories for snapshots and releases:

  • Snapshot repository: https://repo.maven.apache.org/maven2-snapshots (or a custom one)

  • Release repository: https://repo.maven.apache.org/maven2





When to Use Snapshot

  • While developing and testing a new feature.

  • Sharing unstable or work-in-progress code with teammates.

  • Before doing a stable release.




How to Release a Snapshot

When development is complete:

  • Finalize code.
  • Change version from 1.0-SNAPSHOT to 1.0.
  • Deploy to the release repository.