apache / apache/maven

[MNG-7890] Injection of PlexusConfiguration into components

Open
#9,029 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Christoph Läubrich](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=laeubi)** opened **[MNG-7890](https://issues.apache.org/jira/browse/MNG-7890?redirect=false)** and commented

One thing I found while working with components is that from time to time I want to act based on the configuration of the plugin.

At the moment one needs a quite complicated guess work or pass large parameter lists around or even worse parse configurations manually.

It would therefore be great if I could use the following in a component:

```java
@Inject
@Named("my.group.id:my.plugin.id")
private PlexusConfiguration config;
```

that acts as a facade to the "current active configuration of that plugin":

1. plugin not configured at all, no project context available or alike: simply use an empty configuration
2. there is a session an it has projects but no mojos are executing: return the main configuration for that plugin and the active project
3. there is a mojo execution running: return the configuration in respect to the mojo

---

**Affects:** 4.0.0-alpha-7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.