What exactly is a Maven Snapshot and why do we need it?

前端 未结 13 2300
名媛妹妹
名媛妹妹 2020-11-22 07:07

I am a bit confused about the meaning of a Maven Snapshot and why we build one?

13条回答
  •  名媛妹妹
    2020-11-22 07:26

    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).

提交回复
热议问题