View Javadoc

1   package org.apache.maven.execution;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugin.MojoExecution;
23  import org.apache.maven.project.MavenProject;
24  
25  /**
26   * Holds data relevant for an execution event.
27   * 
28   * @author Benjamin Bentmann
29   */
30  public interface ExecutionEvent
31  {
32  
33      /**
34       * The possible types of execution events.
35       */
36      enum Type
37      {
38          ProjectDiscoveryStarted,
39          SessionStarted,
40          SessionEnded,
41          ProjectSkipped,
42          ProjectStarted,
43          ProjectSucceeded,
44          ProjectFailed,
45          MojoSkipped,
46          MojoStarted,
47          MojoSucceeded,
48          MojoFailed,
49          ForkStarted,
50          ForkSucceeded,
51          ForkFailed,
52          ForkedProjectStarted,
53          ForkedProjectSucceeded,
54          ForkedProjectFailed,
55      }
56  
57      /**
58       * Gets the type of the event.
59       * 
60       * @return The type of the event, never {@code null}.
61       */
62      Type getType();
63  
64      /**
65       * Gets the session from which this event originates.
66       * 
67       * @return The current session, never {@code null}.
68       */
69      MavenSession getSession();
70  
71      /**
72       * Gets the current project (if any).
73       * 
74       * @return The current project or {@code null} if not applicable.
75       */
76      MavenProject getProject();
77  
78      /**
79       * Gets the current mojo execution (if any).
80       * 
81       * @return The current mojo execution or {@code null} if not applicable.
82       */
83      MojoExecution getMojoExecution();
84  
85      /**
86       * Gets the exception that caused the event (if any).
87       * 
88       * @return The exception or {@code null} if none.
89       */
90      Exception getException();
91  
92  }