[MNG-5127] CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Scokart Gilles](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gscokart)** opened **[MNG-5127](https://issues.apache.org/jira/browse/MNG-5127?redirect=false)** and commented
The goal is to activate a maven profile based on OS user name.
When I create a standalone project with a profile activation, it works,
however, when I define the profile in a "parent" pom, it is never activated.
this works:
```xml
...
TONY
user.name
WINTONY
```
So in this case, my profile is activated based on my OS user name
```
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Proj1
[INFO] task-segment: [help:active-profiles] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'com.capgemini.be.proj1:parent:pom:4.0.2':
The following profiles are active:
- TONY (source: pom)
```
---
However, if I now have the profiles definition in the "parent" pom, it doesn't work when I build a child project
So the child project references the parent pom containing the profiles and the activation, but when it is built,
the profile is not activated
```xml
...
TONY
user.name
WINTONY
...
```
```xml
com.capgemini.be.proj1
parent
4.0.2
```
```
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Proj1 Application
[INFO] task-segment: [help:active-profiles] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'com.capgemini.be.proj1:proj1-webapp:jar:4.0.2':
There are no active profiles.
```
---
**Attachments:**
- [daddy.zip](https://issues.apache.org/jira/secure/attachment/12712628/daddy.zip) (_3.26 kB_)
- [daddy2.zip](https://issues.apache.org/jira/secure/attachment/12713224/daddy2.zip) (_5.06 kB_)
**Issue Links:**
- [MNG-8392](https://issues.apache.org/jira/browse/MNG-8392) Inherited profiles
(_**"is fixed by"**_)
- [MNG-3228](https://issues.apache.org/jira/browse/MNG-3228) Maven profile activation does not work when profile is defined in inherited 'parent' pom
(_**"is duplicated by"**_)
- [MPH-79](https://issues.apache.org/jira/browse/MPH-79) help:active-profiles does not list active inherited profiles
12 votes, 12 watchers
Contributor guide
Assessment
This issue has not been assessed yet.