[ https://issues.apache.org/jira/browse/MNG-6398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Johnson updated MNG-6398: -------------------------------- Environment: Java: 1.8.0_152 (Oracle), MacOS 10.13.4, Locale: en_US, Encoding: UTF-8 was: Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T11:49:05-08:00) Maven home: /Users/danijoh2/Work/maven-3.5.3 Java version: 1.8.0_152, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac" > 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)