Skip to content

Load rulesUri through the Resolver transporter instead of Wagon - #1475

Merged
slachiewicz merged 3 commits into
masterfrom
agent/rules-without-wagon
Nov 6, 2026
Merged

slachiewicz merged 3 commits into
masterfrom
agent/rules-without-wagon

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

rulesUri is now fetched with the injected Resolver TransporterProvider, using the repository the builder already set up with the session's proxy and the serverId credentials. It works with whatever transports Maven is configured with: file:, http(s):, and Wagon-backed schemes such as scp: or dav: when an extension provides the wagon. Wagon is no longer used: the Map<String, Wagon> constructor parameter of the mojos, reports and the maxDependencyUpdates rule is replaced by TransporterProvider, and the wagon-provider-api, wagon-file and wagon-http dependencies are removed (maven-resolver-spi is provided).

  • Mirrors are not applied to the rules URL, which is a plain URL rather than a repository; the previous code passed the mirror as a mirrored repository and then ignored it.
  • Failures are reported as Could not load specified rules from <uri>: <cause> (for example status code: 401, or no transport available for protocol "scp") instead of a raw RuntimeException.
  • New ITs: rulesUri over file:, over HTTP with serverId and Basic auth, a wrong password, and the enforcer rule with a rulesUri.

Verified: rules ITs (9) and 83 further plugin ITs, all 7 enforcer ITs, unit tests โ†’ pass; display-dependency-updates with file:, http: and http: + Basic auth rules โ†’ pass on Maven 3.9.16 and 4.0.0-rc-7, both stock and without the bundled wagon-file/wagon-http, and with -Dmaven.resolver.transport=wagon on 3.9.16. Not run: the full IT suite, Maven 3.9.0 itself, a real scp:/dav: wagon extension.

@slachiewicz slachiewicz added the enhancement New feature or request label Nov 5, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review November 5, 2026 10:52
Fetch the rules file with the injected TransporterProvider, so rulesUri is served by the transports Maven is configured with (file, http, https, and Wagon-backed schemes such as scp when an extension provides them) and no Wagon providers need to be bundled. The wagon-file and wagon-http runtime dependencies added for rulesUri are removed again.

The rules location is a plain URL, not a repository, so mirror settings are not applied. The previous setMirroredRepositories call had inverted semantics and the Wagon code ignored mirrors anyway; a mirrorOf * entry would otherwise redirect the URL to a repository manager.
The HTTP ITs start an in-JVM server from the setup hook, so no new test dependency is needed. The settings gain two server entries, one with the right and one with the wrong password.
@slachiewicz
slachiewicz force-pushed the agent/rules-without-wagon branch from b968d33 to b38febd Compare November 6, 2026 20:31
@slachiewicz
slachiewicz merged commit 4cfeee8 into master Nov 6, 2026
16 checks passed
@slachiewicz
slachiewicz deleted the agent/rules-without-wagon branch November 6, 2026 21:17
@github-actions github-actions Bot added this to the 2.24.1 milestone Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants