private String generateMojoName(ExecutionEvent executionEvent) { return String.format( "%s/%s/%s/%s", executionEvent.getProject().getName(), executionEvent.getMojoExecution().getGroupId(), executionEvent.getMojoExecution().getArtifactId(), executionEvent.getMojoExecution().getGoal()); }
@Override public void forkedProjectStarted(ExecutionEvent event) { if (logger.isInfoEnabled() && event.getMojoExecution().getForkedExecutions().size() > 1) { logger.info(chars(' ', LINE_LENGTH)); logger.info(chars('>', LINE_LENGTH)); logger.info( "Forking " + event.getProject().getName() + " " + event.getProject().getVersion()); logger.info(chars('>', LINE_LENGTH)); } }
@Override public void projectStarted(ExecutionEvent event) { if (logger.isInfoEnabled()) { logger.info(chars(' ', LINE_LENGTH)); logger.info(chars('-', LINE_LENGTH)); logger.info( "Building " + event.getProject().getName() + " " + event.getProject().getVersion()); logger.info(chars('-', LINE_LENGTH)); } }
@Override public void sessionStarted(ExecutionEvent event) { if (logger.isInfoEnabled() && event.getSession().getProjects().size() > 1) { logger.info(chars('-', LINE_LENGTH)); logger.info("Reactor Build Order:"); logger.info(""); for (MavenProject project : event.getSession().getProjects()) { logger.info(project.getName()); } } }
@Override public void forkSucceeded(ExecutionEvent event) { if (logger.isInfoEnabled()) { StringBuilder buffer = new StringBuilder(128); buffer.append("<<< "); append(buffer, event.getMojoExecution()); append(buffer, event.getProject()); buffer.append(" <<<"); logger.info(""); logger.info(buffer.toString()); } }
@Override public void sessionEnded(ExecutionEvent event) { if (logger.isInfoEnabled()) { if (event.getSession().getProjects().size() > 1) { logReactorSummary(event.getSession()); } logResult(event.getSession()); logStats(event.getSession()); logger.info(chars('-', LINE_LENGTH)); } }
@Override public void mojoSkipped(ExecutionEvent event) { if (logger.isWarnEnabled()) { logger.warn( "Goal " + event.getMojoExecution().getGoal() + " requires online mode for execution but Maven is currently offline, skipping"); } }
@Override public void projectSkipped(ExecutionEvent event) { if (logger.isInfoEnabled()) { logger.info(chars(' ', LINE_LENGTH)); logger.info(chars('-', LINE_LENGTH)); logger.info("Skipping " + event.getProject().getName()); logger.info("This project has been banned from the build due to previous failures."); logger.info(chars('-', LINE_LENGTH)); } }
protected void processExecutionEvent(ExecutionEvent executionEvent) { switch (executionEvent.getType()) { case MojoStarted: sendStatus(generateMojoName(executionEvent), GitHubStatus.Pending); break; case MojoSucceeded: sendStatus(generateMojoName(executionEvent), GitHubStatus.Success); break; case MojoFailed: sendStatus(generateMojoName(executionEvent), GitHubStatus.Failure); break; case ProjectStarted: sendStatus(generateProjectName(executionEvent), GitHubStatus.Pending); break; case ProjectSucceeded: sendStatus(generateProjectName(executionEvent), GitHubStatus.Success); break; case ProjectFailed: sendStatus(generateProjectName(executionEvent), GitHubStatus.Failure); break; default: break; } }
private String generateProjectName(ExecutionEvent executionEvent) { return executionEvent.getProject().getName(); }