You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/09/01 09:20:42 UTC
[PR] Improve standalone ApiRunner to properly apply settings [maven]
gnodet opened a new pull request, #12998:
URL: https://github.com/apache/maven/pull/12998
## Summary
The standalone `ApiRunner` is the main entry point for using the Maven 4 API outside of a full Maven build (e.g. in tools like mvnup). Previously it had several gaps that made it unsuitable for production use — settings were hardcoded to a test directory, proxy/mirror/auth from `settings.xml` were ignored, and dependency resolution machinery was not configured.
This PR fixes all of these issues:
- **Remove hardcoded `user.home = "target"`** — the standalone API now reads settings from the real user home (`~/.m2/settings.xml`)
- **Store effective settings on the session** — `session.getSettings()` now returns the actual effective settings instead of an empty object
- **Apply proxy configuration** from settings via `DefaultProxySelector`
- **Apply mirror configuration** from settings via `DefaultMirrorSelector`
- **Apply server authentication** from settings via `DefaultAuthenticationSelector` (username, password, private key)
- **Configure dependency resolution machinery** via `MavenSessionBuilderSupplier` — `DependencyTraverser`, `DependencyManager`, `DependencySelector`, `DependencyGraphTransformer`, `ArtifactTypeRegistry`, `ArtifactDescriptorPolicy`
- **Detect and set Maven version** from classpath `pom.properties` (fixes `@Nonnull` contract violation)
- **Honor offline mode** from settings
- Clean up stale TODO comments and dead commented-out code
Also makes 5 getter methods in `MavenSessionBuilderSupplier` public (from protected) so they can be reused by `ApiRunner` across packages.
## Test plan
- [x] All 611 tests in `maven-impl` pass (0 failures)
- [x] `TestApiStandalone` — verifies artifact resolution and dependency collection work
- [x] `RequestTraceTest` — verifies request tracing works with standalone session
- [x] `DiTest` — verifies DI wiring
- [x] `maven-core` compiles successfully with the visibility changes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve standalone ApiRunner to properly apply settings [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12998:
URL: https://github.com/apache/maven/pull/12998
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org