Skip to content

help:active-profiles reports incorrect source in Maven 4.0.0-rc-4 for multi-module projects #11409

@juulhobert

Description

@juulhobert

Affected version

4.0.0-rc4

Bug description

When running the help:active-profiles goal in a multi-module project, Maven 4.0.0-rc produces incorrect output compared to Maven 3.9.11. Profiles activated in the parent POM are incorrectly reported as active because of the source: current (sub)project. Maven 3.9.11 correctly reports the source.

A minimal reproducer is available here: https://github.com/juulhobert/active-profiles-reproducer

Maven 3.9.11 output (./mvnw.cmd help:active-profiles)

[INFO] Scanning for projects...
[INFO] 
[INFO] ----------< tech.juuls:active-profiles-reproducer-subproject >----------
[INFO] Building active-profiles-reproducer-subproject 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- help:3.5.1:active-profiles (default-cli) @ active-profiles-reproducer-subproject ---
[INFO] 
Active Profiles for Project 'tech.juuls:active-profiles-reproducer-subproject:jar:1.0-SNAPSHOT':

The following profiles are active:

 - active-profiles-reproducer (source: tech.juuls:active-profiles-reproducer:1.0-SNAPSHOT)
 - subproject-child (source: tech.juuls:active-profiles-reproducer-subproject:1.0-SNAPSHOT)



[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.713 s
[INFO] Finished at: 2025-11-07T15:33:12+01:00
[INFO] ------------------------------------------------------------------------

Maven 4.0.0-rc4 output (./mvnw.cmd help:active-profiles)

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------------------< tech.juuls:active-profiles-reproducer-subproject >-----------------------------------
[INFO] Building active-profiles-reproducer-subproject 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] ---------------------------------------------------------[ jar ]----------------------------------------------------------
[INFO] 
[INFO] --- help:3.5.1:active-profiles (default-cli) @ active-profiles-reproducer-subproject ---
[INFO] 
Active Profiles for Project 'tech.juuls:active-profiles-reproducer-subproject:jar:1.0-SNAPSHOT':

The following profiles are active:

 - active-profiles-reproducer (source: tech.juuls:active-profiles-reproducer-subproject:jar:1.0-SNAPSHOT)
 - subproject-child (source: tech.juuls:active-profiles-reproducer-subproject:jar:1.0-SNAPSHOT)



[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Total time:  1.527 s
[INFO] Finished at: 2025-11-07T15:32:29+01:00
[INFO] --------------------------------------------------------------------------------------------------------------------------

Suspected cause
The issue may be caused by the use of the effective model on this line:

result.getEffectiveModel().getId(), getProfileIds(result.getActivePomProfiles()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions