4

In POM of my project I've noticed the following config:

 <repositories>
    <repository>
      <id>nexus</id>
      <url>http://path/to/nexus</url>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
     </repository>
  </repositories>

I'm curious what does it mean and what impact has setting updatePolicy to never compared to the default daily?. Does it make builds faster? What are the cases when update happens?

Official docs are not very helpful:

updatePolicy: This element specifies how often updates should attempt to occur. Maven will compare the local POM’s timestamp (stored in a repository’s maven-metadata file) to the remote. The choices are: always, daily (default), interval:X (where X is an integer in minutes) or never.

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
  • I believe [this answer](http://stackoverflow.com/a/16425036/944849) will help. – user944849 Dec 18 '15 at 14:23
  • @user944849 thanks, but it is still not clear for me what does 'newer copy' in case of releases mean and whether I can always safely set `updatePolicy` to `never`. – Michal Kordas Dec 18 '15 at 14:26

1 Answers1

3

Update policy controls the querying of upstream (remote) repositories for newer snapshot versions. From all I know it does not apply to release in terms of updating a specific release, but only to potentially finding new release versions or update fact about versions being available or not. New versions will however not be used automatically but the information can e.g. be used by the versions maven plugin.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123