网站
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 的日期/时间值。
这个转换是在类 SnapshotTransformation
内部完成的Maven 源代码:
String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber(); version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
什么是SNAPSHOT版本可以在类ArtifactUtils
中看到:如果版本以 "SNAPSHOT"
结尾且忽略大小写,则此代码认为版本是 SNAPSHOT 版本。对于这种情况,the code also如果 SNAPSHOT 不存在,则在它之前添加破折号。
因此,从源代码来看,这本书有一部分是正确的:它应该是“结束于”而不是“包含”。
关于maven - Maven 存储库中 SNAPSHOT 版本的规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34791181/