Description
Bas van Erp opened MRESOLVER-634 and commented
maven-metadata.xml is refetched for every dependency which uses version-ranges if the resolver-status.properties
file's "lastUpdated" property is before last midnight (local time, for some reason).
It ignores all updatePolicy configs in settings.xml
I have tried diving into the code, but as I'm not a programmer, I couldn't really wrap my head around it.
Setup
- Have a
settings.xml
with<updatePolicy>never</updatePolicy>
for everything. - Have a
pom.xml
with a dependency which uses a version-range. - Run
mvn validate
to trigger the resolver and make sure all metadata and dependencies are downloaded and the Maven cache is warmed up.
Correct
- Use https://www.epochconverter.com/ to create a millisecond timestamp for today (local-time): 00:00:01
- Replace the
xxx.xml.lastUpdated=###
timestamp in theresolver-status.properties
file of the dependency which is referenced in the pom.xml - Run
mvn validate -X
to trigger the resolver. It should return something like: "Skipped remote request for x:y/maven-metadata.xml, locally cached metadata up-to-date" - Good
Wrong
- Use https://www.epochconverter.com/ to create a millisecond timestamp for yesterday (local-time): 23:59:59
- Replace the
xxx.xml.lastUpdated=###
timestamp in theresolver-status.properties
file of the dependency which is referenced in the pom.xml - Run
mvn validate
to trigger the resolver. - The resolver will download the maven-metadata.xml again. Every day.
Impact
We have some dependencies which use version ranges for a lot of transitive dependencies, and I hate it for multiple reasons. But to add insult to injury, every night the first build will refetch all these metadata files in order to see if version resolution needs to change. ;)
I have found no way to block this, since version-ranges seem to bypass repository updatePolicy settings.
Affects: 1.9.22
Issue Links:
- MNG-5997 Continuous download of maven-metadata.xml for version ranges.