Example usage for org.apache.maven.execution BuildFailure getCause

List of usage examples for org.apache.maven.execution BuildFailure getCause

Introduction

In this page you can find the example usage for org.apache.maven.execution BuildFailure getCause.

Prototype

public Throwable getCause() 

Source Link

Document

Gets the cause of the build failure.

Usage

From source file:net.java.jpatch.maven.common.AbstractMavenMojo.java

License:Apache License

/**
 * Builds the MAVEN session.// www . j  av a2s  .  c o m
 * 
 * @param session the MAVEN session.
 * 
 */
protected void buildMavenSession(MavenSession session) {
    List<String> buildGoals = Arrays.asList(goals.split(","));
    List<String> buildProfiles = null;
    if (profiles != null) {
        buildProfiles = Arrays.asList(profiles.split(","));
    }

    eventCatapult.fire(ExecutionEvent.Type.SessionStarted, session, null);
    for (MavenProject project : session.getProjects()) {
        BuildSummary buildSummary = buildMavenProject(project, buildGoals, buildProfiles);
        session.getResult().addBuildSummary(buildSummary);
        if (buildSummary instanceof BuildFailure) {
            BuildFailure bf = (BuildFailure) buildSummary;
            session.getResult().addException(bf.getCause());
            break;
        }
    }
    eventCatapult.fire(ExecutionEvent.Type.SessionEnded, session, null);
}