You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/08/30 16:07:44 UTC
[PR] [MNG-8749] Hide PathTranslator from API [maven]
elharo opened a new pull request, #12941:
URL: https://github.com/apache/maven/pull/12941
Fixes #10326 / [MNG-8749](https://issues.apache.org/jira/browse/MNG-8749).
`org.apache.maven.api.services.model.PathTranslator` has exactly one implementation that is only used internally (in the `impl` package). This PR removes the interface from the public API and folds its single `alignToBaseDirectory(String, Path)` method directly into the internal `org.apache.maven.impl.model.DefaultPathTranslator` implementation.
Changes:
- Deletes `api/maven-api-spi/.../services/model/PathTranslator.java`.
- `DefaultPathTranslator` no longer implements the interface; it now carries `alignToBaseDirectory` directly and is marked as an internal, non-public-API implementation.
- Updates the four internal consumers to reference `DefaultPathTranslator` instead:
- `DefaultModelInterpolator`
- `DefaultModelPathTranslator`
- `DefaultModelBuilder`
- `DefaultProfileActivationContext`
No external API callers are affected: the interface had no implementers outside the `impl` tree, and `maven-testing` (which manually wires these impl constructors) passes `new DefaultPathTranslator()` directly, which remains valid.
Verified: full `maven-impl` unit test suite (610 tests, 0 failures) plus compilation of `maven-api-spi`, `maven-testing`, `maven-core`, and `maven-cli`.
--
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] [MNG-8749] Remove PathTranslator and UrlNormalizer from public API [maven]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12941:
URL: https://github.com/apache/maven/pull/12941#issuecomment-5508773444
@elharo Please assign appropriate label to PR according to the type of change.
--
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] [MNG-8749] Hide PathTranslator from API [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on PR #12941:
URL: https://github.com/apache/maven/pull/12941#issuecomment-5499376495
That makes sense. Static methods are *good* for pure functions like these. Not every function needs to be turned into a pluggable object. Some should just work.
--
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] [MNG-8749] Hide PathTranslator from API [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on PR #12941:
URL: https://github.com/apache/maven/pull/12941#issuecomment-5477601828
I think this approach is a large heap of YAGNI. This is just the one example I happened to stumble in first. Removing it from the public API makes the API and system simpler and still allows it to be added in later if it anyone ever needs, though I very much doubt anyone ever will.
--
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] [MNG-8749] Remove PathTranslator and UrlNormalizer from public API [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo merged PR #12941:
URL: https://github.com/apache/maven/pull/12941
--
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] [MNG-8749] Hide PathTranslator from API [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #12941:
URL: https://github.com/apache/maven/pull/12941#issuecomment-5499142225
I did some research into what plugins and extensions in the Maven ecosystem actually use from the `services/model` package. Here's what I found — it might help frame the discussion beyond `PathTranslator` specifically.
The package splits into three tiers based on real-world external usage:
**Tier 1 — Actively reimplemented by plugins (must keep as SPI)**
These have multiple independent custom implementations across the ecosystem (Maven 3 API today, which is the evidence base for what Maven 4 will need):
- **ModelProcessor** — polyglot-maven, jgitver, qoomon/maven-git-versioning-extension, maven-tiles, Spring Boot thin launcher. The most-replaced interface in the entire model-building SPI.
- **ProfileActivator** — random-maven/profile-activator-extension (MVEL), kpiwko/el-profile-activator, stephenc/docker-maven-profile-activator, rrialq/jsr223-profile-activator.
- **ProfileSelector** — random-maven (AND-linked activation), johnjcool/and-activation-profile-selector, sviperll/ozymandias.
- **ModelValidator** — JetBrains IntelliJ, XMvn/Fedora, Spring Gradle dependency-management-plugin.
- **ModelInterpolator** — flatten-maven-plugin, Spring Gradle, JetBrains IntelliJ.
**Tier 2 — Required by Tier 1 contracts or deliberately extensible**
Not reimplemented themselves, but needed by the interfaces that are:
- **ProfileActivationContext** — parameter type in `ProfileActivator.isActive()` and `ProfileSelector.getActiveProfiles()`. Removing it from the SPI breaks the contract for all Tier 1 activator/selector extensions.
- **RootDetector** — extends `Service`, loaded via `ServiceLoader` in `DefaultRootLocator`, already has 2 implementations (`DotMvnRootDetector`, `PomXmlRootDetector`). Explicitly designed for extension.
- **ModelVersionParser** — intentionally decoupled from `VersionParser` (the javadoc says so explicitly) to let model building work without a full Maven session. Used as a constructor parameter in `PropertyProfileActivator`.
- **ModelResolver** — already reimplemented against the Maven 4 API by mizdebsk/dola-gleaner.
- **ProfileInjector**, **RootLocator** — consumed externally.
**Tier 3 — No external usage, safe to remove**
Zero reimplementations, not part of any extension contract:
- **PathTranslator** — `alignToBaseDirectory(String, Path)`
- **UrlNormalizer** — `normalize(String)`
Both are pure stateless functions — no fields, no dependencies, no side effects. The entire Tier 3 SPI surface is two utility methods.
Rather than replacing interface-based DI with concrete-class-based DI (which keeps injecting a stateless singleton through 4+ constructors), a cleaner approach would be to make both static methods — eliminating the interface, the DI plumbing, and the constructor parameters from the 6 consumers altogether.
--
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