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

Daniel Johnson commented on MNG-6398:
-------------------------------------

++Hi [~khmarbaise] - I guess I was (wrongly) under the impression that this was 
an allowable configuration.  The Parent POM does NOT reference the aggregator 
as its parent, so this is not a true circular dependency.  The Parent POM is 
simply being used for dependency/plugin management.  The aggregator references 
the Parent as a <module> simply so that the Parent is part of the reactor.  
This allows changes to the Parent to be picked up without having to release and 
uptick the parent version in the aggregator.  If you think this is not a use 
case that was intended to work then I will rethink my project. 

> Multithread Build Hangs Execution with sonar:sonar goal when Aggregator POM 
> references a Child Module as its Parent
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-6398
>                 URL: https://issues.apache.org/jira/browse/MNG-6398
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.5, 3.2.5, 3.3.9, 3.5.3
>         Environment: Java: 1.8.0_152 (Oracle), MacOS 10.13.4, Locale: en_US, 
> Encoding: UTF-8
>            Reporter: Daniel Johnson
>            Priority: Major
>              Labels: Hanging, Multimodule, aggregator, multithread, 
> multithreading
>         Attachments: maven-hanging-stack.txt, 
> maven-multithread-hanging-sample.zip
>
>
> h1. Problem Statement
> I have an Aggregator POM whose Parent POM is also one of its child Modules. 
> When I run a multi-thread Maven build with normal goals, such as 'clean 
> install' it works as expected; The Parent module builds first followed by the 
> Aggregator.
> However when running '{{mvn sonar:sonar -T 2'}} the build hangs indefinitely 
> (from {{org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905}}).
> h1. Sample Project
> Attached.
> h3. Layout
> {{/pom.xml}}
> {{/parent/pom.xml}}
> h1. Reproducing the Issue
> A normal multi-threaded build should work as expected: {{mvn clean install -T 
> 2}}
> But when running sonar goal, it hangs indefinitely: {{mvn sonar:sonar -T 2}} 
> (This can also be reproduced with {{mvn clean install sonar:sonar -T 2}}, in 
> which case it hangs immediately after building and installing both projects)
> {{DANIJOH2-M-C5DB:deadlock-sample danijoh2$ mvn sonar:sonar -T 2}}
> {{[INFO] Scanning for projects...}}
> {{[INFO] 
> ------------------------------------------------------------------------}}
> {{[INFO] Reactor Build Order:}}
> {{[INFO]}}
> {{[INFO] parent [pom]}}
> {{[INFO] aggregator [pom]}}
> {{[INFO]}}
> {{[INFO] Using the MultiThreadedBuilder implementation with a thread count of 
> 2}}
> {{<process is now hung>}}
> Running the same build with a single thread works fine: {{mvn sonar:sonar}}
> h2. Stack Trace of Hanging Maven Process
> Attached.
> h2. Summary
> I saw the same behavior with Maven 3.0.5, 3.2.3, and 3.3.9, as well with 
> sonar-maven-plugin 3.0 and 3.3.0.603 with the same results. From the stack 
> trace, it seems Maven itself is hung (not deadlocked though), and while it 
> may be caused by the Sonar plugin, it seems the fix likely needs to come from 
> Maven.
> If I make the aggregator itself the parent (and get rid of the parent module 
> entirely) then it works fine. The problem with this approach, is in our 
> project we are also creating aggregated site reports for our project, which 
> if I recall correctly when I tried this last time, the aggregated reports 
> were not always working as expected when the aggregator POM builds before its 
> modules.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to