View Javadoc

1   package org.apache.maven;
2   
3   import org.apache.maven.plugin.MojoFailureException;
4   
5   /**
6    * Exception which occurs when a normal (i.e. non-aggregator) mojo fails to
7    * execute. In this case, the mojo failed while executing against a particular
8    * project instance, so we can wrap the {@link MojoFailureException} with context
9    * information including projectId and the {@link MojoBinding} that caused the
10   * failure.
11   *
12   * @author jdcasey
13   *
14   */
15  public class ProjectBuildFailureException
16      extends BuildFailureException
17  {
18  
19      private final String projectId;
20  
21      public ProjectBuildFailureException( String projectId, MojoFailureException cause )
22      {
23          super( "Build for project: " + projectId + " failed during execution of mojo.", cause );
24  
25          this.projectId = projectId;
26      }
27  
28      public MojoFailureException getMojoFailureException()
29      {
30          return (MojoFailureException) getCause();
31      }
32  
33      public String getProjectId()
34      {
35          return projectId;
36      }
37  }