Package io.github.rajendarreddyj.tomcat
Class DeployMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.github.rajendarreddyj.tomcat.AbstractTomcatMojo
io.github.rajendarreddyj.tomcat.DeployMojo
- All Implemented Interfaces:
ContextEnabled,Mojo
@Mojo(name="deploy",
requiresDependencyResolution=RUNTIME,
threadSafe=true)
public class DeployMojo
extends AbstractTomcatMojo
Deploys or redeploys the webapp to a running Tomcat instance.
This goal copies the exploded WAR directory to Tomcat's webapps directory. If a deployment already exists at the target location, it is removed before the new deployment is copied. This provides a quick way to update a running application without restarting Tomcat.
Note: Tomcat must be configured for automatic deployment (autoDeploy="true" in Host element) for the changes to take effect immediately. Otherwise, a Tomcat restart may be required.
Usage
mvn tomcat:deploy
Configuration Example
<plugin>
<groupId>io.github.rajendarreddyj</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<contextPath>/myapp</contextPath>
<warSourceDirectory>${project.build.directory}/${project.build.finalName}</warSourceDirectory>
</configuration>
</plugin>
- Since:
- 1.0.0
- Author:
- rajendarreddyj
- See Also:
-
Field Summary
Fields inherited from class io.github.rajendarreddyj.tomcat.AbstractTomcatMojo
autopublishEnabled, autopublishInactivityLimit, catalinaBase, catalinaHome, classpathAdditions, contextPath, debugHost, debugPort, debugSuspend, deploymentOutputName, environmentVariables, httpHost, httpPort, javaHome, project, shutdownTimeout, skip, startupTimeout, tomcatCacheDir, tomcatVersion, vmOptions, warSourceDirectory -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.github.rajendarreddyj.tomcat.AbstractTomcatMojo
buildDeployableConfiguration, buildJdwpAgentArg, buildServerConfiguration, detectInstalledVersion, downloadTomcat, resolveCatalinaHome, validateDebugPortAvailable, validateJavaVersion, validatePortAvailable, validateTomcatInstallationMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
DeployMojo
public DeployMojo()
-
-
Method Details
-
execute
Executes the deploy goal.This method performs the following steps:
- Builds server and deployment configurations
- Removes any existing deployment at the target location
- Copies the exploded WAR to Tomcat's webapps directory
- Throws:
MojoExecutionException- if an error occurs during deploymentMojoFailureException- if deployment fails due to invalid configuration
-