Stable SNAPSHOT Identifiers

Martin Klepsch edited this page Jun 19, 2017 · 6 revisions

When a SNAPSHOT version is deployed to Clojars (or any other Maven repository) it is internally assigned a time-based version identifier. Whenever a new SNAPSHOT is uploaded old releases of the same SNAPSHOT version remain available under their time-based version identifier.
This can be useful to avoid the pitfalls of using SNAPSHOT versions — changing dependencies without you noticing — while still being able to benefit from the latest and greatest fixes and features.

An Example

Let's assume we have a project clojars/test and deploy a snapshot 0.1.0-SNAPSHOT. Once the deploy is complete the list of versions inside the Maven repository will roughly look like this:

0.1.0-20170205.160151-1
0.1.0-SNAPSHOT (points to the above)

Now a day later we discover a bug in our SNAPSHOT and subsequently release another one:

0.1.0-20170205.160151-1
0.1.0-20170206.170424-2
0.1.0-SNAPSHOT (points to 0.1.0-20170206.170424-2)

In your project.clj or build.boot you can now use any of the below:

[clojars/test "0.1.0-20170205.160151-1"]
[clojars/test "0.1.0-20170206.170424-2"]
[clojars/test "0.1.0-SNAPSHOT"]

If you use 0.1.0-SNAPSHOT your Maven client will check for a new SNAPSHOT release once a day, potentially changing the code of a dependency you are using without you noticing. If you use one of the time-based identifiers there is no automatic updating to watch out for. This of course also means that you need to check for new versions manually.

Note: Clojars maintains the full history of SNAPSHOT releases but not all Maven repositories do. So before using this technique with other Maven repositories, do check if they keep all SNAPSHOT versions.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.