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 java.io.File;
20
21 import org.apache.maven.plugin.MojoExecutionException;
22
23 /**
24 * Deploy a WAR in-place to Tomcat.
25 *
26 * @goal inplace
27 *
28 * @todo depend on war:inplace when MNG-1649 resolved
29 *
30 * @author Mark Hobson <markhobson@gmail.com>
31 * @version $Id: InplaceMojo.java 6588 2008-03-28 12:22:57Z bentmann $
32 */
33 public class InplaceMojo
34 extends AbstractDeployMojo
35 {
36 // ----------------------------------------------------------------------
37 // Mojo Parameters
38 // ----------------------------------------------------------------------
39
40 /**
41 * The path of the inplace WAR directory to deploy.
42 *
43 * @parameter expression = "${basedir}/src/main/webapp"
44 * @required
45 */
46 private File warSourceDirectory;
47
48 // ----------------------------------------------------------------------
49 // Protected Methods
50 // ----------------------------------------------------------------------
51
52 /*
53 * @see org.codehaus.mojo.tomcat.AbstractDeployMojo#getWarFile()
54 */
55 protected File getWarFile()
56 {
57 return warSourceDirectory;
58 }
59
60 /*
61 * @see org.codehaus.mojo.tomcat.AbstractDeployMojo#validateWarFile()
62 */
63 protected void validateWarFile()
64 throws MojoExecutionException
65 {
66 if ( !warSourceDirectory.exists() || !warSourceDirectory.isDirectory() )
67 {
68 throw new MojoExecutionException( getMessage( "InplaceMojo.missingWar", warSourceDirectory.getPath() ) );
69 }
70 }
71 }