View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.execution;
20  
21  import org.apache.maven.plugin.Mojo;
22  import org.apache.maven.plugin.MojoExecution;
23  import org.apache.maven.project.MavenProject;
24  
25  /**
26   * <p>
27   * Encapsulates parameters of MojoExecutionListener callback methods and is meant to provide API evolution path should
28   * it become necessary to introduce new parameters in the existing callbacks in the future.
29   * </p>
30   * <strong>Note:</strong> This class is part of work in progress and can be changed or removed without notice.
31   *
32   * @see MojoExecutionListener
33   * @see org.apache.maven.execution.scope.WeakMojoExecutionListener
34   * @since 3.1.2
35   */
36  public class MojoExecutionEvent {
37      private final MavenSession session;
38  
39      private final MavenProject project;
40  
41      private final MojoExecution mojoExecution;
42  
43      private final Mojo mojo;
44  
45      private final Throwable cause;
46  
47      public MojoExecutionEvent(MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo) {
48          this(session, project, mojoExecution, mojo, null);
49      }
50  
51      public MojoExecutionEvent(
52              MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo, Throwable cause) {
53          this.session = session;
54          this.project = project;
55          this.mojoExecution = mojoExecution;
56          this.mojo = mojo;
57          this.cause = cause;
58      }
59  
60      public MavenSession getSession() {
61          return session;
62      }
63  
64      public MavenProject getProject() {
65          return project;
66      }
67  
68      public MojoExecution getExecution() {
69          return mojoExecution;
70      }
71  
72      public Mojo getMojo() {
73          return mojo;
74      }
75  
76      public Throwable getCause() {
77          return cause;
78      }
79  }