1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.plugin;
18
19 import org.apache.maven.plugin.AbstractMojo;
20 import org.apache.maven.plugin.MojoExecutionException;
21 import org.apache.maven.plugin.MojoFailureException;
22 import org.apache.maven.plugin.logging.Log;
23
24 /**
25 * Support for Mojo implementations.
26 *
27 * @version $Id: MojoSupport.java 422054 2006-07-14 21:25:59Z jdillon $
28 */
29 public abstract class MojoSupport
30 extends AbstractMojo
31 {
32 protected Log log;
33
34 protected void init() {
35 log = getLog();
36 }
37
38 public void execute() throws MojoExecutionException, MojoFailureException {
39 init();
40
41 try {
42 doExecute();
43 }
44 catch (Exception e) {
45 if (e instanceof MojoExecutionException) {
46 throw (MojoExecutionException)e;
47 }
48 else if (e instanceof MojoFailureException) {
49 throw (MojoFailureException)e;
50 }
51 else {
52 throw new MojoExecutionException(e.getMessage(), e);
53 }
54 }
55 }
56
57 protected void doExecute() throws Exception {
58
59 }
60 }