gnodet opened a new pull request, #14211:
URL: https://github.com/apache/maven/pull/14211
## Summary
- Adds an `<activation>` element to `<extension>` in `settings.xml`, reusing
the existing `Activation` model type (property, jdk, os, file, activeByDefault)
- Enables conditional loading of extensions declared in user or installation
settings based on runtime conditions
- Activation is evaluated pre-DI in `BaseParser` via a lightweight
`ExtensionActivationEvaluator`
## Motivation
Extensions declared in user-wide settings (e.g. diagnostic tools like
`maven-timeline-extension`) currently load unconditionally. There is no way to
install an extension globally and selectively activate it per build. This
change allows property-gated activation so users can run `mvn -Dtimeline
verify` to opt in.
## Example
```xml
<!-- ~/.m2/settings.xml -->
<settings>
<extensions>
<extension id="com.github.seregamorph:maven-timeline-extension:1.0">
<activation>
<property><name>timeline</name></property>
</activation>
</extension>
</extensions>
</settings>
```
The extension loads only when `-Dtimeline` is passed. Without the flag, it
is skipped.
## Test plan
- [x] Unit tests for `ExtensionActivationEvaluator` covering: no activation,
activeByDefault, property presence/value/negation, JDK version/range, OS
family, file exists/missing, multiple conditions (AND semantics)
- [x] All 960 existing `maven-cli` tests pass
- [ ] Verify existing settings extension ITs still pass in CI
🤖 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]