Search code examples
mavenmaven-reactor

Is SNAPSHOT or non-SNAPSHOT the convention for libraries and Maven when doing a release for others to use?


I'm excluding this from the trunk vs branch release question because that's a separate issue.

Assuming you have finished your development iteration, and are pushing out a release for other people to use in their projects.

Now some members of my team say:

SNAPSHOT is for iterating in your team - and non-SNAPSHOTs are for actual releases.

But when I look at the reactor plugin and associated commentary - it appears to say the opposite:

You're only supposed to release SNAPSHOT versions. That means your version number would be like 3.0.3-SNAPSHOT.

My question is: Is SNAPSHOT or non-SNAPSHOT the convention for libraries and Maven when doing a release for others to use?


Solution

  • See Maven: The Complete Reference, 3.3.1. Project Versions:

    SNAPSHOT Versions

    Maven versions can contain a string literal to signify that a project is currently under active development. If a version contains the string “-SNAPSHOT,” then Maven will expand this token [...] when you install or release this component.

    ...

    Why would you use this? SNAPSHOT versions are used for projects under active development. [...], if the next release of your system is going to have a version "1.4", your project would have a version "1.4-SNAPSHOT" until it was formally released.

    ...

    When releasing a project, you should resolve all dependencies on SNAPSHOT versions to dependencies on released versions. If a project depends on a SNAPSHOT, it is not stable as the dependencies may change over time. [...] SNAPSHOT versions are for development only.

    [Emphasizes by me.]

    This means for me:

    From a technical POV one can release any version, snapshot or not. But a (technically) released snapshot version is not a (formally) released version from a semantical POV.