001package org.apache.maven.execution; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.maven.plugin.Mojo; 023import org.apache.maven.plugin.MojoExecution; 024import org.apache.maven.project.MavenProject; 025 026/** 027 * Encapsulates parameters of MojoExecutionListener callback methods and is meant to provide API evolution path should 028 * it become necessary to introduce new parameters in the existing callbacks in the future. 029 * 030 * @see MojoExecutionListener 031 * @see org.apache.maven.execution.scope.WeakMojoExecutionListener 032 * @since 3.1.2 033 * @provisional This class is part of work in progress and can be changed or removed without notice. 034 */ 035public class MojoExecutionEvent 036{ 037 private final MavenSession session; 038 039 private final MavenProject project; 040 041 private final MojoExecution mojoExecution; 042 043 private final Mojo mojo; 044 045 private final Throwable cause; 046 047 public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo ) 048 { 049 this( session, project, mojoExecution, mojo, null ); 050 } 051 052 public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo, 053 Throwable cause ) 054 { 055 this.session = session; 056 this.project = project; 057 this.mojoExecution = mojoExecution; 058 this.mojo = mojo; 059 this.cause = cause; 060 } 061 062 public MavenSession getSession() 063 { 064 return session; 065 } 066 067 public MavenProject getProject() 068 { 069 return project; 070 } 071 072 public MojoExecution getExecution() 073 { 074 return mojoExecution; 075 } 076 077 public Mojo getMojo() 078 { 079 return mojo; 080 } 081 082 public Throwable getCause() 083 { 084 return cause; 085 } 086}