Skip to content

Maven threaded build output #3675

Closed

Description

@cbm64chris

Apache NetBeans version

Apache NetBeans 13 release candidate

What happened

When the maven option of -T is configured in a multi-module reactor, in my example in the .mvn/maven.config, the output window loses track of the folding and this throws;

java.lang.NullPointerException: Cannot invoke "org.openide.windows.FoldHandle.silentStartFold(boolean)" because "parentProject.foldHandle" is null
	at org.netbeans.modules.maven.execute.cmd.ExecutionEventObject$Tree.startFold(ExecutionEventObject.java:179)
	at org.netbeans.modules.maven.execute.CommandLineOutputHandler$Output.run(CommandLineOutputHandler.java:352)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

The build continues in the background but the output is stalled. I have not had an opportunity to dig into this yet, but I will do so and provide more detailed understanding when my project commitment is lessoned.

I am using a maven pom that contains significant number of plugins that are run for each member module.

How to reproduce

  • Create a multi-module reactor
  • Configure to build in parallel
  • Run using Clean & Build control

Did this work correctly in an earlier version?

No

Operating System

Mac OS X version 12.2.1 running on x86_64

JDK

OpenJDK Runtime Environment 17.0.2+8-LTS

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No response

Code of Conduct

Yes

Activity

  1. added
    kind:bug
    needs:triage
    on Feb 25, 2022
  2. added
    Maven
    and removed
    needs:triage
    on Jun 19, 2022
  3. jglick commented on Nov 10, 2022

    @jglick
    Contributor

    Long broken. Happens in 16-rc3 when running SpotBugs in a multimodule reactor using mvnd.

  4. jglick commented on Nov 10, 2022

    @jglick
    Contributor

    Long broken. Can be reproduced in trunk (running IDE on Java 17 if it matters):

    …
    [cli] 
    [cli] 
    [cli] [INFO] 
    [cli] [INFO] --- maven-checkstyle-plugin:3.2.0:check (validate) @ cli ---
    [jenkins-bom] 
    [jenkins-bom] 
    [jenkins-bom] [INFO] 
    [jenkins-bom] [INFO] >>> spotbugs-maven-plugin:4.7.2.1:check (spotbugs) > :spotbugs @ jenkins-bom >>>
    
    --- spotbugs-maven-plugin:4.7.2.1:spotbugs (spotbugs) @ jenkins-bom ---
    

    Has something to do with the forked execution of https://spotbugs.github.io/spotbugs-maven-plugin/check-mojo.html.

    Unfortunately the obvious quick fixes like

    diff --git java/maven/src/org/netbeans/modules/maven/execute/cmd/ExecutionEventObject.java java/maven/src/org/netbeans/modules/maven/execute/cmd/ExecutionEventObject.java
    index 06f23c7faf..0e310e783c 100644
    --- java/maven/src/org/netbeans/modules/maven/execute/cmd/ExecutionEventObject.java
    +++ java/maven/src/org/netbeans/modules/maven/execute/cmd/ExecutionEventObject.java
    @@ -175,7 +175,9 @@ public class ExecutionEventObject {
                 ExecutionEventObject.Tree parentProject = findParentNodeOfType(ExecutionEvent.Type.MojoStarted);
                 if (parentProject != null) {
                     //in forked environment..
    -                assert parentProject.foldHandle != null;
    +                if (parentProject.foldHandle == null) {
    +                    return;
    +                }
                     this.foldHandle = parentProject.foldHandle.silentStartFold(true);
                     return;
                 }

    do not work—you just get NPEs later from a variety of other methods here or in CommandLineOutputHandler. There is a lot of complex, sparsely commented logic here with numerous unchecked accesses to supposedly nullable fields, and no test coverage that I can find. Other than a small patch in #2309, the code all seems to predate the Apache donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Mavenkind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions