Maven 存储库中 SNAPSHOT 版本的规则
Rules for SNAPSHOT versions in Maven repository
网站
http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-syntax.html
州
If a version contains the string “-SNAPSHOT,” then Maven will expand
this token to a date and time value converted to UTC (Coordinated
Universal Time) when you install or release this component.
从字面上看,不仅 1.2.3-SNAPSHOT
的常见示例表现得像 SNAPSHOT 版本,而且 1.2.3-RC-SNAPSHOT
或 1.2.3-SNAPSHOT-RC
之类的东西也是如此?
的确,每个以 SNAPSHOT
结尾的版本都将替换为转换为 UTC 的 date/time 值。
这个转换是在Maven源码的classSnapshotTransformation
里面完成的:
String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
什么是 SNAPSHOT 版本可以在 class 中看到 ArtifactUtils
: this code considers that a version is a SNAPSHOT version if its version ends with "SNAPSHOT"
ignoring case. For this case, the code also 如果 SNAPSHOT 还没有的话,在它之前添加一个破折号。
所以,从源代码来看,这本书是部分正确的:应该是"ends with"而不是"contains"。
网站
http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-syntax.html
州
If a version contains the string “-SNAPSHOT,” then Maven will expand this token to a date and time value converted to UTC (Coordinated Universal Time) when you install or release this component.
从字面上看,不仅 1.2.3-SNAPSHOT
的常见示例表现得像 SNAPSHOT 版本,而且 1.2.3-RC-SNAPSHOT
或 1.2.3-SNAPSHOT-RC
之类的东西也是如此?
的确,每个以 SNAPSHOT
结尾的版本都将替换为转换为 UTC 的 date/time 值。
这个转换是在Maven源码的classSnapshotTransformation
里面完成的:
String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber(); version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
什么是 SNAPSHOT 版本可以在 class 中看到 ArtifactUtils
: this code considers that a version is a SNAPSHOT version if its version ends with "SNAPSHOT"
ignoring case. For this case, the code also 如果 SNAPSHOT 还没有的话,在它之前添加一个破折号。
所以,从源代码来看,这本书是部分正确的:应该是"ends with"而不是"contains"。