1

The Gradle documentation suggests that "Maven uses [its local repository] as a cache, not a repository". This cache can be cleared manually, but how long does Maven cache artifacts before refetching artifact metadata or artifacts themselves?

hertzsprung
  • 9,445
  • 4
  • 42
  • 77
  • 4
    Simply never except for SNAPSHOT which can be configured by using the updatePolicy in settings.xml (https://maven.apache.org/settings.html). For releases it makes no sense cause releases are immutable. – khmarbaise Mar 26 '21 at 09:14

1 Answers1

3

Maven expects non--SNAPSHOT artifacts to be immutable. Once a release has been fetched, Maven will not refresh metadata or artifacts again. Neither will it evict or clear down the cache, although you may wish to do this yourself.

As @khmarbaise's comment notes:

except for SNAPSHOT which can be configured by using the updatePolicy in settings.xml (https://maven.apache.org/settings.html)

Joe
  • 29,416
  • 12
  • 68
  • 88
  • I don't think it is generally true. Maven checks and downloads the release versions again after some time. I couldn't find a rule when and why it happens. – 30thh Mar 29 '23 at 13:29