List of usage examples for org.apache.maven.execution DefaultMavenExecutionResult getBuildSummary
public BuildSummary getBuildSummary(MavenProject project)
From source file:com.paulhammant.buildradiatorextension.BuildRadiatorEventSpy.java
License:Open Source License
@Override public void onEvent(Object event) throws Exception { try {// w w w. j a va 2 s . c o m try { if (event instanceof ExecutionEvent) { ExecutionEvent executionEvent = (ExecutionEvent) event; MavenProject project = executionEvent.getProject(); String lifecyclePhase = executionEvent.getMojoExecution().getLifecyclePhase(); String phase = lifecyclePhase.substring(lifecyclePhase.lastIndexOf(':') + 1); String execution = executionEvent.getMojoExecution().getExecutionId(); String currentArtifactId = project.getArtifactId(); if (!projectPropertiesDone) { this.buildRadiatorInterop.projectProperties(project.getProperties(), project.getArtifactId()); projectPropertiesDone = true; } String status = executionEvent.getType().toString(); if (executionEvent.getType() == ExecutionEvent.Type.MojoStarted) { status = "started"; } else if (executionEvent.getType() == ExecutionEvent.Type.MojoFailed) { status = "failed"; } else if (executionEvent.getType() == ExecutionEvent.Type.MojoSucceeded) { status = "passed"; } this.buildRadiatorInterop.executionEvent(phase, execution, currentArtifactId, status); } if (event instanceof DefaultMavenExecutionResult) { DefaultMavenExecutionResult dmer = (DefaultMavenExecutionResult) event; this.buildRadiatorInterop.executionResult( dmer.getBuildSummary(dmer.getProject()) instanceof BuildSuccess, dmer.getBuildSummary(dmer.getProject()) instanceof BuildFailure); } } catch (NullPointerException e) { // do nothing } } catch (Throwable e) { e.printStackTrace(); } }