[
https://issues.apache.org/jira/browse/MNG-6398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16447299#comment-16447299
]
Karl Heinz Marbaise commented on MNG-6398:
------------------------------------------
The point is if the aggregator would *NOT* use the parent as a module
everything would be fine but the parent is also used as module where I'm the
opinion this should fail the build which it currently not does nor should the
build stuck....I understand you intention. I used that setup also except for
using the parent also as a module...
> 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)