我对Maven快照的含义有点困惑,为什么我们要构建一个?
当前回答
understanding the context of SDLC will help understand the difference between snapshot and the release. During the dev process developers all contribute their features to a baseline branch. At some point the lead thinks enough features have accumulated then he will cut a release branch from the baseline branch. Any builds prior to this time point are snapshots. Builds post to this point are releases. Be noted, release builds could change too before going to production if any defect spot during the release testing.
其他回答
在开发阶段,Maven快照每天都会寻找更新的更高版本(如果在nexus存储库中可用),然后在本地下载它以备下一次构建。
您可以在存储库定义中设置四个选项
总是这样, 每日(默认), 间隔, 永远,
注意:在产品版本中,我们不应该依赖于快照版本。
understanding the context of SDLC will help understand the difference between snapshot and the release. During the dev process developers all contribute their features to a baseline branch. At some point the lead thinks enough features have accumulated then he will cut a release branch from the baseline branch. Any builds prior to this time point are snapshots. Builds post to this point are releases. Be noted, release builds could change too before going to production if any defect spot during the release testing.
我想谈谈术语。其他答案很好地解释了什么是Maven上下文中的“快照”版本。但是,非快照版本是否应该被称为“发布”版本呢?
在“发布”版本的语义版本控制思想之间存在一些紧张关系,“发布”版本似乎是任何没有-SNAPSHOT这样的限定符,但也没有-beta.4这样的限定符的版本;以及Maven的“发布”版本的想法,它似乎只包括没有-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.
因此,尽管Maven如此,在我看来,只将“发布”版本称为根本没有任何限定符(甚至没有-beta.4)的版本似乎更合适。对于Maven非快照版本来说,更好的名称可能是“稳定”版本(灵感来自另一个答案)。这样我们就有:
1.2.3-beta。4-SNAPSHOT:预发布版本的快照版本。 1.2.3-SNAPSHOT:发布版本的快照版本。 1.2.3-beta。4:预发布版本的稳定版本。 1.2.3:发布版本(显然是一个稳定的非快照版本)。
这就是存储库的快照的样子,在本例中没有启用快照,这意味着这里引用的存储库是稳定的,不需要更新。
<project>
...
<repositories>
<repository>
<id>lds-main</id>
<name>LDS Main Repo</name>
<url>http://code.lds.org/nexus/content/groups/main-repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
另一种情况是:
<snapshots>
<enabled>true</enabled>
</snapshots>
这意味着Maven将为这个存储库查找更新。您还可以使用标记指定更新间隔。
简单快照意味着它是一个不稳定的版本。
当版本包含快照,如1.0.0 -SNAPSHOT意味着它不是稳定的版本,并寻找远程存储库来解决依赖关系
推荐文章
- 在流中使用Java 8 foreach循环移动到下一项
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 用Java计算两个日期之间的天数
- 如何配置slf4j-simple
- 在Jar文件中运行类
- 带参数的可运行?
- 我如何得到一个字符串的前n个字符而不检查大小或出界?
- 我可以在Java中设置enum起始值吗?
- Java中的回调函数
- c#和Java中的泛型有什么不同?和模板在c++ ?
- 在Java中,流相对于循环的优势是什么?
- Jersey在未找到InjectionManagerFactory时停止工作
- 在Java流是peek真的只是调试?
- Recyclerview不调用onCreateViewHolder
- 将JSON字符串转换为HashMap