001    package org.apache.maven;
002    
003    import org.apache.maven.plugin.MojoFailureException;
004    
005    /**
006     * Exception which occurs when a normal (i.e. non-aggregator) mojo fails to
007     * execute. In this case, the mojo failed while executing against a particular
008     * project instance, so we can wrap the {@link MojoFailureException} with context
009     * information including projectId and the {@link MojoBinding} that caused the
010     * failure.
011     *
012     * @author jdcasey
013     *
014     */
015    public class ProjectBuildFailureException
016        extends BuildFailureException
017    {
018    
019        private final String projectId;
020    
021        public ProjectBuildFailureException( String projectId, MojoFailureException cause )
022        {
023            super( "Build for project: " + projectId + " failed during execution of mojo.", cause );
024    
025            this.projectId = projectId;
026        }
027    
028        public MojoFailureException getMojoFailureException()
029        {
030            return (MojoFailureException) getCause();
031        }
032    
033        public String getProjectId()
034        {
035            return projectId;
036        }
037    }