SNAPSHOT 或非 SNAPSHOT 是库和 Maven 在发布供他人使用时的约定吗?

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

我将此排除在 trunk vs branch release 问题之外,因为这是一个单独的问题。

假设您已经完成了开发迭代,并且正在推出一个版本供其他人在他们的项目中使用。

现在我的一些团队成员说:

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

但是当我查看 reactor 插件和相关评论时 - 它似乎 say the opposite:

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

我的问题是:在发布供他人使用的版本时,库和 Maven 的惯例是 SNAPSHOT 还是非 SNAPSHOT?

SNAPSHOT在开发过程中赋值,开发完成后需要发布,那么你的版本不会包含SNAPSHOT。您可以在 Internet 上对此进行交叉验证。我们用于一般用途的 jar 不包含 SNAPSHOT。最后它们都是 GA (General Available) 版本。

示例:spring-data-mongodb-1.9.2.RELEASE。所以你的团队成员说的是真的。

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.

[由我强调。]

这对我来说意味着:

从技术 POV 可以发布任何版本,快照与否。但是(技术上)发布的快照版本不是来自语义 POV 的(正式)发布版本