> On 26 Nov 2024, at 14:38, nor...@gies.team wrote:
>
> Hi Martin,
> Thanks a lot for your response.
>
> This is a handy feature I have already used during my investigations.
>
> It shows the recognized behavior (that the profiles of the parent pom modules
> are not available in the project).
>
> My current question is, should it be like this, or should the profiles
> defined in a parent pom module also be available in a project like those
> defined in the parent pom directly?
Behaviour as is is what should be expected. A multi-module pom is mechanism to
aggregate multiple modules that should be jointly built in the right sequence,
not a project that bundles all modules into a single whole.
As such there is not even a need for a parent/child relationship between the
aggregating multimodule root and the contained modules. See also
https://maven.apache.org/guides/mini/guide-multiple-modules.html
To see the profiles defined in module-a you should make your project not extend
from parent.pom.main, but from module-a.
All profiles defined in a project’s parent or one of its hierarchical ancestors
(parent’s parent, parent’s parent’s parent etc) is what should be expected to
be present as available profiles.
Running `mvn help:all-profiles` on the modified setup (module-a as the parent)
yields the effect you were expecting:
[INFO] --- help:3.5.1:all-profiles (default-cli) @ sample-project ---
[INFO] Listing Profiles for Project: sample:sample-project:jar:1.0.0-SNAPSHOT
Profile Id: my_module_a_profile_a (Active: false, Source: pom)
Profile Id: my_parent_pom_profile (Active: false, Source: pom)
>
> Best
> Norman
>
> On 2024/11/26 13:22:37 Martin Höller wrote:
>> Hi!
>>
>> Sorry for my previous (empty) mail. Sent it unintentionally.
>>
>> Problably the maven-help-plugin [0] could be of help for you. It provides
>> the active-profiles and all-profiles Goals, which could be handy.
>>
>> hth,
>> - martin
>>
>> [0] https://maven.apache.org/plugins/maven-help-plugin/plugin-info.html
>>
>> Am 26. Nov. 2024 schrieb nor...@gies.team:
>>
>>> Good day,
>>>
>>> I am trying to use maven profiles separated into modules (<modules> in a
>>> parent pom).
>>>
>>> After successfully installing the parent pom (and the modules), I tried to
>>> use the profiles.
>>>
>>> Profiles located in the parent POM still work as before, but new profiles
>>> located in a module do not.
>>>
>>> I tried to activate the profiles with the command parameter -P, e.g.,
>>> Pmy-profile-name-in-parent-pom, or, e.g., Pmy-profile-name-in-module-a.
>>>
>>> The command mvn help:all-profiles also lists only the profiles directly in
>>> the parent pom.
>>>
>>> I wanted to figure out whether this should or should not work. It would be
>>> great if you could give me a hint.
>>>
>>> Best
>>> Norman
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org