Scope Maven mirror to external:* instead of * - #1594
Merged
Conversation
Artifactory cannot serve artifacts that live on the developer's own machine, so mirroring localhost/file:// repositories can only fail to resolve. Excluding them costs no governance: they are not downloads from a remote registry. Every repository fetched over the network still resolves through Artifactory. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
yahavi
approved these changes
Jul 28, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
ConfigureArtifactoryRepositorywrites<mirrorOf>*</mirrorOf>into~/.m2/settings.xml. In Maven,*matches every repository — including ones declared onlocalhostor with afile://URL, such as the staging repository used bymaven-invoker-pluginintegration tests.Artifactory cannot serve artifacts that live on the developer's own machine, so mirroring those repositories can only fail to resolve. Excluding them costs no governance: they are not downloads from a remote registry.
Fix
Scope the mirror to
external:*, which per the Maven mirror guide matches all repositories exceptlocalhost/file://ones. Every repository fetched over the network still resolves through Artifactory.Scope note: this does not change which remote repositories are intercepted. It is not a fix for unrelated Maven builds failing when the configured repository does not proxy a project's upstreams.
Tests
TestConfigureArtifactoryRepository_MirrorScopeIsExternalOnly— readsmirrorOfby mirror id, so a user mirror that happens to declare the same scope cannot satisfy the assertion; also asserts an existing user mirror keeps its ownmirrorOf.TestConfigureArtifactoryRepository_MirrorScopeStableOnRepoint— re-running against a different repository keeps exactly one mirror, keeps theexternal:*scope, and repoints the URL.central,*,!local-repo,blocked-*) left unchanged.Verified locally:
go build,go vet,gofmtclean; theartifactory/utils/mavensuite passes; reverting the constant to*fails both new tests; andjf setup mvn's tests injfrog-cli-artifactory(TestSetupCommand_Maven,TestSetupCommand_MavenCorrupted) pass against this branch via a temporaryreplacedirective.🤖 Generated with Claude Code