You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Documentation says that version ranges should not resolve to SNAPSHOT, but SNAPSHOT repos are still queried #906
Resolution of dependency ranges should not resolve to a snapshot (development version) unless it is included as an explicit boundary.
However, in my observations, ALL configured repositories are queried for available versions, without regard to whether they are configured for snapshots or releases. It is possible that the quoted portion is still correct, and that SNAPSHOT versions are filtered out after retrieval. However, the expected behavior is that if these versions are to be excluded, then the repositories configured for snapshots only, should never be queried at all when resolving version ranges. This may be a bug elsewhere in Maven, but the linked documentation from the maven-enforcer-plugin should, at the very least, document this behavior, if it is expected.
Note: this behavior is particularly problematic, because repository.apache.org is configured as a snapshot repository by default in the Apache parent POM, and INFRA blocks when you access repository.apache.org with too many 404s. This means that too many version ranges anywhere in your dependency tree will get you banned, even if you never depended on any SNAPSHOT versions.
For latter: yes, ASF will block you if you produce excessive amount of 404s, but asking for metadata will not cause 404, unless you ask for GA that is for sure not on ASF repo.
For latter: yes, ASF will block you if you produce excessive amount of 404s, but asking for metadata will not cause 404, unless you ask for GA that is for sure not on ASF repo.
The metadata that is being asked for that does cause 404s is the maven-metadata.xml files that are per artifactId, and are used to resolve version ranges.
And given ASF repo publishes prefix files, just by adding this extension will prevent your Maven to ask for GAs not present on ASF repo.
Presumably, using a new enough version of Maven and/or using this plugin will help prevent some 404s when looking up specific artifact information, but I don't know if that will help in the specific code path where version ranges are resolved, since that code path already has the groupId and artifactId, and is just looking at the metadata to determine what versions are available on the server. Even if it does help in that specific version range resolution code path, it's very hard to get everybody on the newer version of Maven that checks for these prefix files.
In any case, this issue is mainly about the incomplete documentation of Maven's behavior of checking these snapshot repos for versions even when it can't resolve to a snapshot version. This plugin's documentation links to that confluence page, so I placed the issue here. I'm not actually sure who is responsible for maintaining that confluence page's contents.
I filed a separate bug about the behavior itself, since it probably is a bug (apache/maven#2558). If the version range cannot resolve to a snapshot version, according to this documentation, then snapshot-only repos should never be queried at all, rather than their results filtered out later. Filtering at the artifact level, based on the results of the metadata, or based on the prefixes, both seem far too late.
Activity
Avoid unnecessarily accessing snapshot repositories
cstamas commentedon Jul 2, 2025
For latter: yes, ASF will block you if you produce excessive amount of 404s, but asking for metadata will not cause 404, unless you ask for GA that is for sure not on ASF repo.
For this, ideally one can use RRF (remote repository filtering):
https://maveniverse.eu/docs/heimdall/
And given ASF repo publishes prefix files, just by adding this extension will prevent your Maven to ask for GAs not present on ASF repo.
ctubbsii commentedon Jul 3, 2025
The metadata that is being asked for that does cause 404s is the maven-metadata.xml files that are per artifactId, and are used to resolve version ranges.
Presumably, using a new enough version of Maven and/or using this plugin will help prevent some 404s when looking up specific artifact information, but I don't know if that will help in the specific code path where version ranges are resolved, since that code path already has the groupId and artifactId, and is just looking at the metadata to determine what versions are available on the server. Even if it does help in that specific version range resolution code path, it's very hard to get everybody on the newer version of Maven that checks for these prefix files.
In any case, this issue is mainly about the incomplete documentation of Maven's behavior of checking these snapshot repos for versions even when it can't resolve to a snapshot version. This plugin's documentation links to that confluence page, so I placed the issue here. I'm not actually sure who is responsible for maintaining that confluence page's contents.
I filed a separate bug about the behavior itself, since it probably is a bug (apache/maven#2558). If the version range cannot resolve to a snapshot version, according to this documentation, then snapshot-only repos should never be queried at all, rather than their results filtered out later. Filtering at the artifact level, based on the results of the metadata, or based on the prefixes, both seem far too late.
Avoid unnecessarily accessing snapshot repositories (#5709)
slawekjaranowski commentedon Jul 6, 2025
Can we do something more in enforcer project with it?
ctubbsii commentedon Aug 29, 2025
It seems like the enforcer plugin should not link to the old confluence page at https://github.com/apache/maven-enforcer/blob/master/maven-enforcer-plugin/src/site/site.xml#L41-L43
Update Version Ranges link in site.xml
Update Version Ranges link in site.xml (#926)