1 package org.codehaus.mojo.tomcat;
2
3 /*
4 * Copyright 2005 Mark Hobson.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 import org.apache.maven.plugin.MojoExecutionException;
20
21 /**
22 * Abstract goal that provides common configuration for Catalina-based goals.
23 *
24 * @author Mark Hobson <markhobson@gmail.com>
25 * @version $Id: AbstractWarCatalinaMojo.java 6588 2008-03-28 12:22:57Z bentmann $
26 */
27 public abstract class AbstractWarCatalinaMojo
28 extends AbstractCatalinaMojo
29 {
30 // ----------------------------------------------------------------------
31 // Mojo Parameters
32 // ----------------------------------------------------------------------
33
34 /**
35 * The packaging of the Maven project that this goal operates upon.
36 *
37 * @parameter expression = "${project.packaging}"
38 * @required
39 * @readonly
40 */
41 private String packaging;
42
43 // ----------------------------------------------------------------------
44 // Mojo Implementation
45 // ----------------------------------------------------------------------
46
47 /*
48 * @see org.apache.maven.plugin.Mojo#execute()
49 */
50 public void execute()
51 throws MojoExecutionException
52 {
53 if ( !isWar() )
54 {
55 getLog().info( getMessage( "AbstractWarCatalinaMojo.nonWar" ) );
56 return;
57 }
58
59 super.execute();
60 }
61
62 // ----------------------------------------------------------------------
63 // Protected Methods
64 // ----------------------------------------------------------------------
65
66 /**
67 * Gets whether this project uses WAR packaging.
68 *
69 * @return whether this project uses WAR packaging
70 */
71 protected boolean isWar()
72 {
73 return "war".equals( packaging );
74 }
75 }