maven snapshot updates

孤人 提交于 2019-12-03 19:54:04

问题


I have a maven project with a snapshot dependency. How does maven know if the snapshot needs to be updated? Does it always update? Is it time based? A checksum based update? I know I can force an update but otherwise, how does it check?

thanks, Jeff


回答1:


According to the docs, the default is that it will only update once a day. That is when the first build of the day is executed. You can override this behavior with the snapshot-policy element.

  • always - always check when Maven is started for newer versions of snapshots
  • never - never check for newer remote versions. Once off manual updates can be performed.
  • daily (default) - check on the first run of the day (local time)
  • interval:XXX - check every XXX minutes

http://maven.apache.org/maven-settings/settings.html




回答2:


I have a maven project with a snapshot dependency. How does maven know if the snapshot needs to be updated?

Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. See for example hibernate-core-3.5.0-SNAPSHOT in JBoss snapshots repository.

Does it always update? Is it time based? A checksum based update?

This depends on the updatePolicy of the repository or pluginRepository containing the snapshots. The default is a daily check (other possibles values are always, interval:X (where X is an integer in minutes) or never.

When you use SNAPSHOT internally for a project under active development, it is very common to set the <updatePolicy>always</updatePolicy> for the internal repository.



来源:https://stackoverflow.com/questions/2148111/maven-snapshot-updates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!