void (@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType != ProcessOutputTypes.STDOUT) return; String text = event.getText().trim(); if (text.isEmpty()) return; String textWithoutInfo = ""; if (text.startsWith("[INFO] ")) { textWithoutInfo = text.substring("[INFO] ".length()).trim(); } switch (myState) { case STATE_INITIAL -> { // initial state. if (textWithoutInfo.equals("Reactor build order:")) { myState = STATE_READING_PROJECT_LIST_OLD_MAVEN; } else if (textWithoutInfo.equals("Reactor Build Order:")) { myState = STATE_READING_PROJECT_LIST; } } case STATE_READING_PROJECT_LIST -> { if (textWithoutInfo.equals("------------------------------------------------------------------------")) { myState = STATE_WAIT_FOR_BUILD; } else if (!textWithoutInfo.isEmpty()) { myMavenProjectNames.add(textWithoutInfo); } else if (!myMavenProjectNames.isEmpty()) { myState = STATE_WAIT_FOR______; } } case STATE_READING_PROJECT_LIST_OLD_MAVEN -> { if (!textWithoutInfo.isEmpty()) { if (text.startsWith("[INFO] ")) { myMavenProjectNames.add(textWithoutInfo); } else { myState = STATE_WAIT_FOR_BUILD; } } } case STATE_WAIT_FOR_BUILD -> { if (textWithoutInfo.startsWith("Building ")) { String projectName = textWithoutInfo.substring("Building ".length()); if (myBuildingProjectIndex >= myMavenProjectNames.size() || !projectName.startsWith(myMavenProjectNames.get(myBuildingProjectIndex))) { myState = STATE_WTF; log(String.format("Invalid project building order. Defined order: %s, error index: %d, invalid line: %s", myMavenProjectNames, myBuildingProjectIndex, text)); break; } myBuildingProjectIndex++; } myState = STATE_WAIT_FOR______; } case STATE_WAIT_FOR______ -> { if (textWithoutInfo.equals("------------------------------------------------------------------------")) { myState = STATE_WAIT_FOR_BUILD; } } case STATE_WTF -> { } default -> throw new IllegalStateException(); } }