简体   繁体   English

“强制更新快照/发布” - 这是什么意思

[英]“Force update of snapshots/releases” - what does it mean

In a Maven project, on selecting "Update project", there is an option called "Force update of snapshots/releases". 在Maven项目中,在选择“更新项目”时,有一个名为“强制更新快照/发布”的选项。 What does it do? 它有什么作用?

"Force update of snapshots/releases" is like running following command “强制更新快照/版本”就像运行以下命令一样

mvn -U install

-U is also be used alternatively as --update-snapshot. -U也可以作为--update-snapshot使用。 See here . 看到这里

Eclipse's m2eclipse plugin internally calls the same using maven-core API. Eclipse的m2eclipse插件使用maven-core API在内部调用相同的内容。

See setUpdateSnapshots method. 请参见setUpdateSnapshots方法。

In the world of Maven, any project or component must have its own version. 在Maven的世界中,任何项目或组件都必须有自己的版本。 The value of the version may be 1.0.0, 1.3-alpha-4, 2.0, 2.1-SNAPSHOT or 2.1-20091214.221414-13. 版本的值可以是1.0.0,1.3-alpha-4,2.0,2.1-SNAPSHOT或2.1-20091214.221414-13。 Among them, 1.0, 1.3-alpha-4 and 2.0 are stable release versions, while 2.1-SNAPSHOT and 2.1-20091214.221414-13 are unstable snapshot versions. 其中,1.0,1.3-alpha-4和2.0是稳定版本,而2.1-SNAPSHOT和2.1-20091214.221414-13是不稳定的快照版本。

Why does Maven distinguish between release and snapshot versions? 为什么Maven会区分发行版和快照版? Simple 1.0.0, 1.2, 2.1, etc. is not enough? 简单的1.0.0,1.2,2.1等是不够的? Why even 2.1-SNAPSHOT, or even long 2.1-20091214.221414-13? 为什么连2.1-SNAPSHOT,甚至长2.1-20091214.221414-13? Imagine this situation, Zhang in the development of module A version 2.1, the version has not yet officially released, together with the development of module A module B, which is developed by Xiao Zhang Ji family members, B function depends on the A The In the development process, Zhang often need to build their own latest output, to the quarter MM, for her development and integration debugging, the question is, how does this work? 想象一下这种情况,张先生在开发模块A版本2.1时,版本尚未正式发布,再加上模块A模块B的开发,这是由小张吉家族成员开发的,B功能取决于A的In在开发过程中,张经常需要建立自己的最新输出,到了季度MM,对于她的开发和集成调试,问题是,这是如何工作的? If you keep updating version 2.1.1, 2.1.2, 2.1.3 .... First of all, Xiao Zhang and quarter MM both need to frequently change the POM, if there are more modules dependent on the module A, will involve more POM changes; 如果你不断更新版本2.1.1,2.1.2,2.1.3 ....首先,小张和季MM都需要经常更改POM,如果有更多的模块依赖于模块A,将涉及更多POM变化; Second, a large number of versions actually contains only a small difference, this will Resulting in abuse of version number. 其次,大量版本实际上只包含很小的差异,这将导致滥用版本号。 Maven's snapshot version mechanism is to solve the above problem. Maven的快照版本机制是解决上述问题。 In this example, Xiao Zhang only need to set the version of module A to 2.1-SNAPSHOT, and then released to the PW, in the process of publishing, Maven will automatically for the component timestamp. 在这个例子中,小张只需要将模块A的版本设置为2.1-SNAPSHOT,然后发布到PW,在发布过程中,Maven会自动为组件设置时间戳。 For example: 2.1-20091214.221414-13 on December 14, 2009 22:14 14 seconds of the 13th snapshot. 例如:2.1-20091214.221414-13于2009年12月14日22:14第14快照的14秒。 With this timestamp, Maven will be able to find the latest file in the repository 2.1-SNAPSHOT version at any time. 有了这个时间戳,Maven将能够随时在存储库2.1-SNAPSHOT版本中找到最新文件。 At this time, the season MM configuration for the module A 2.1-SNAPSHOT version of the dependency, when she component module B, Maven will automatically check from the warehouse module A 2.1-SNAPSHOT the latest component, when found to be updated when the download The By default, Maven checks an update every day (controlled by the repository's updatePolicy), and the user can also use the command line -U to force Maven to check for updates, such as: mvn clean install-U. 这时,本季MM配置为模块A 2.1-SNAPSHOT版本的依赖,当她组件模块B时,Maven会自动从仓库模块A 2.1-SNAPSHOT检查最新组件,当发现下载时更新时默认情况下,Maven每天检查一次更新(由存储库的updatePolicy控制),用户也可以使用命令行-U强制Maven检查更新,例如:mvn clean install-U。 Based on the snapshot version mechanism, Zhang can deploy the component to the warehouse after the build is successful, and the quarter MM can not take into account the building of module A, and she can ensure that you can get the latest available snapshot widgets for module A at all times. 基于快照版本机制,Zhang可以在构建成功后将组件部署到仓库,并且季度MM不能考虑模块A的构建,并且她可以确保您可以获取最新的可用快照窗口小部件模块A始终。 Requires additional manual operation. 需要额外的手动操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM