[ 
https://issues.apache.org/jira/browse/MNG-6741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16983975#comment-16983975
 ] 

Karl Heinz Marbaise commented on MNG-6741:
------------------------------------------

So first my strong recommendation is against a profile in relationship with 
modules. This will result in many problems/issues etc. not describes in the 
smartics article. Also see 
https://blog.soebes.de/blog/2013/11/09/why-is-it-bad-to-activate-slash-deactive-modules-by-profiles-in-maven/

If you really have different release cycles for different modules this is a 
strong indicator for separating those into separate projects.

Apart from that based on your example project if you give {{mvn -f 
parent/pom.xml clean}} you will see something like this:
{code}
MNG-6741$ mvn -f parent/pom.xml clean 
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] parent                                                             [pom]
[INFO] math                                                               [jar]
[INFO] 
[INFO] ------------------------< modules.demo:parent >-------------------------
[INFO] Building parent 1.0.0-SNAPSHOT                                     [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ parent ---
[INFO] 
[INFO] -------------------------< modules.demo:math >--------------------------
[INFO] Building math 1.0.0-SNAPSHOT                                       [2/2]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ math ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for parent 1.0.0-SNAPSHOT:
[INFO] 
[INFO] parent ............................................. SUCCESS [  0.137 s]
[INFO] math ............................................... SUCCESS [  0.003 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.256 s
[INFO] Finished at: 2019-11-27T23:16:28+01:00
[INFO] ------------------------------------------------------------------------
{code}

If you just give {{mvn -f build/pom.xml clean}} you will address only a single 
pom file which has a parent. This pom does NOT contain any module definition 
which means it will try to find other modules as you already seen.

You seemed to expect that giving a parent automatically means it will use its 
content as a kind of include file, but it's content is only use to inherit from 
and so the modules part is simply ignored. This results in what you have 
described.
The question is: Should Maven allow so usage? Allow a parent which contains 
module definitions? I would say this should fail the build.



> Modules aggregation from parent does not work
> ---------------------------------------------
>
>                 Key: MNG-6741
>                 URL: https://issues.apache.org/jira/browse/MNG-6741
>             Project: Maven
>          Issue Type: Bug
>            Reporter:  Thomas Lehmann
>            Priority: Major
>         Attachments: demo-maven-modules.zip
>
>
> Hi Maven Team,
> for testing purpose I have a simple setup:
>  * three modules in parallel
>  ** one for the "build" with a relative path to the "parent"
>  ** one for the "parent" with the modules section having "../math" as one 
> module
> (for now without any profile)
>  ** one for the "math" with a relative path to the "parent"
>  * I'm running in the root *Maven 3.6.1* with *mvn -f build clean* 
> My expectation:
>  * I would like to see "math" in the reactor build order and summary (which 
> is not the case)
>  
> Of course using "<modules> ... </modules>" just in the build/pom.xml works 
> fine.
> My intention was to split up modules definitions of a real project into 
> different profiles in the parent pom being surprised that no module were 
> suddently recognized when trying to build.
> That link does describes my intention so I assumed it just work fine: 
> https://www.smartics.eu/confluence/display/BLOG/2013/07/22/Using+Aggregate+and+Parent+POMs
> I can say that it also doesn't work with 3.3.9.
> Maybe I missed a certain instruction being required ... then I'm sorry and 
> asking you ... please let me know.
> Kind Regards,
> Thomas



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to