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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to