示例#1
0
  protected void processExecutionResult(DefaultMavenExecutionResult executionResult) {
    BuildSummary bs = executionResult.getBuildSummary(executionResult.getProject());

    if (bs instanceof BuildSuccess) {
      sendStatus(bs.getProject().getName(), GitHubStatus.Success);
    } else if (bs instanceof BuildFailure) {
      sendStatus(bs.getProject().getName(), GitHubStatus.Failure);
    } else {
      logger.error(
          "m2github - unknown status for "
              + bs.getProject().getName()
              + " - "
              + bs.getClass().getName());
    }
  }
  private void logReactorSummary(MavenSession session) {
    logger.info(chars('-', LINE_LENGTH));

    logger.info("Reactor Summary:");

    logger.info("");

    MavenExecutionResult result = session.getResult();

    for (MavenProject project : session.getProjects()) {
      StringBuilder buffer = new StringBuilder(128);

      buffer.append(project.getName());

      buffer.append(' ');
      while (buffer.length() < LINE_LENGTH - 21) {
        buffer.append('.');
      }
      buffer.append(' ');

      BuildSummary buildSummary = result.getBuildSummary(project);

      if (buildSummary == null) {
        buffer.append("SKIPPED");
      } else if (buildSummary instanceof BuildSuccess) {
        buffer.append("SUCCESS [");
        buffer.append(getFormattedTime(buildSummary.getTime()));
        buffer.append("]");
      } else if (buildSummary instanceof BuildFailure) {
        buffer.append("FAILURE [");
        buffer.append(getFormattedTime(buildSummary.getTime()));
        buffer.append("]");
      }

      logger.info(buffer.toString());
    }
  }