apache / apache/maven

[MNG-8292] Rework profile activation

Open
#10,533 1 comment 0 reactions 0 assignees View on GitHub
maintenance priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Guillaume Nodet](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gnt)** opened **[MNG-8292](https://issues.apache.org/jira/browse/MNG-8292?redirect=false)** and commented

Profile activation needs to be reworked.

I propose to deprecate the full `` element and replace it with a single ` ... ` element which would contain an expression as described in MNG-8286.  The only missing bit is the `activeByDefault` feature which may need a few additional functions such as `active(profile-id)` and `{}inactive(profile-id){`}.

A few points to keep in mind:
* project properties are used in a non coherent way now, this needs to be cleaned up. There are use cases to leverage those properties during profile activation, but we need to ensure that the early activated profile (computed on the file model to get the list of subprojects) are stable.  One way would be to make sure that the list of subprojects does not change between the activated file model and the effective model, either by checking that the resulting lists are the same, or by actually doing it in two steps: a first activation would inject the subprojects into the file model and a later step would compute the effective model, ignoring the subprojects

* ultimately, the profile activation interpolation step should go away, as properties can be interpolated on the fly during the expression evaluation (and I would not go into interpreting the value of a property as an expression recursively)

* for cascading profiles, my initial idea was that a profile can never be deactivated once activated.  So to compute the list of profiles, you start from a complete list, find out which ones are activated, remove them from the list and incorporate the properties into the context, and loop.  This ensures we can't run into infinite loops where a profile is activated, then deactivate..., then activated, etc...

---

**Sub-tasks:**
- [MNG-3309](https://issues.apache.org/jira/browse/MNG-3309) Cascading profile activation

- [MNG-8286](https://issues.apache.org/jira/browse/MNG-8286) Add a condition profile based on a simple expressions

- [MNG-8768](https://issues.apache.org/jira/browse/MNG-8768) Add a function for conditional profile activation evaluating to true if a certain executable can be found in the system path

**Issue Links:**
- [MNG-4917](https://issues.apache.org/jira/browse/MNG-4917) Profile not active even though it has activeByDefault set to true
(_**"incorporates"**_)

1 votes, 4 watchers

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are named. Start by reading MNG-8286, then review MNG-3309 and MNG-8768 and the linked activeByDefault issue. Done would require an agreed implementation for expression-based activation, cascading profiles, property handling, and stable early subproject activation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.