Migrate to Maven Dependency Injection
The major task of this epic is to migrate (Maven) away from Plexus (original title). The discussion which led to the epic even mentioned a migration to Eclipse Sisu.
However, this seems to be some kind of incomplete or at least non-precise as there are many Plexus components used in Maven. Hence, we first need to clarify the scope of the epic by evaluating the current state and lead some stakeholder discussions.
Problem statement
Background: Context and Dependency Injection
While running a Maven build, Maven executes many plugins. In fact, Maven can be considered as a framework for plugin execution. Plugins need some context, and - in many cases - options to communicate across so-called lifecycle phases. The context contains information about the surrounding environment, in the case of Maven, the project which is subject to the Maven build.
To provide context, Java frameworks have established the so-called dependency injection technique (Note: We will not elaborate on implementation considerations and a pro/con discussion here) (DI), thus following the Dependency Inversion principle. Historically, Maven has used the Plexus Container framework to implement DI. Plexus Container now is in deprecated state and has moved to Eclipse Sisu.
Further Findings
- 🔥 CAUTION: Unclear project/source status
- As of 2025-01-04, the contained Eclipse Sisu project seems outdated on its [Eclipse project page](https://projects.eclipse.org/projects/technology.sisu).
Target: Use Maven Dependency Injection
For misc. reasons (TBD: which reasons), Maven 4 developed its own DI container. Now, all (core) components should switch to the new DI framework, resulting in complete independence of Eclipse Sisu (and any other intermediate DI framework, e.g., Google Guice).
Boundaries
Plexus is a large framework containing many components to make Java development easier, for instance, by
- Handling operating-system-specific issues.
- Adding convenient language features.
- Handling compilers.
Therefore, we will find many dependencies to some of the classic Plexus' components. But we should be aware that only very little has a relationship to dependency injection. Getting rid of more Plexus dependencies is subject to other activities and beyond our scope here.
Todos
- [ ] Document current state
- [ ] Check current documentation
- [ ] Evaluate dependencies, e.g., with jQAssistant -> This might also help for other Epics
- [ ] Document new DI framework (Code seems to have not even Javadocs)
- [ ] Propose a migration path
- [ ] Add automation where possible, e.g., via OpenRewrite
Current state of DI migration
TBD
Current documentation
- Check the dev mailing list
- Check Confluence, e.g.,
- for Dependency Injection,
- Plexus, or
- Guice
- Check Jira, e.g.,
- MNG-7954: Provide a cleaner DI api
- Note that searching Jira is hard in this case, as many issues contain the terms
dependencyorPlexus
Current DI dependencies
- Check the list of internal/widely used plugins
- Search for other plugins, e.g.,
- Mojohaus
- Fabric8
- Other ASF projects like JMeter
- Sonatype
-
GitHub in General (note: There are not so many that have the
<packaging>maven-plugin</packaging>, according to some API search)curl -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/search/repositories?q=<packaging>maven-plugin</packaging>&type=repositories" | tee gh-repos.json