Package io.github.rajendarreddyj.tomcat
Class StopMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.github.rajendarreddyj.tomcat.AbstractTomcatMojo
io.github.rajendarreddyj.tomcat.StopMojo
- All Implemented Interfaces:
ContextEnabled,Mojo
@Mojo(name="stop",
defaultPhase=POST_INTEGRATION_TEST,
threadSafe=true)
public class StopMojo
extends AbstractTomcatMojo
Stops a running Apache Tomcat instance started by the start goal.
This goal attempts to stop Tomcat gracefully using the following strategy:
- If a PID file exists in CATALINA_BASE, terminates the process directly
- If no PID file is found, attempts to stop via the catalina script
- If graceful shutdown times out, forcibly terminates the process
Usage
mvn tomcat:stop
Configuration
The shutdown timeout can be configured using the
tomcat.timeout.shutdown
property (default: 30 seconds).
- 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
-
StopMojo
public StopMojo()
-
-
Method Details
-
execute
Executes the stop goal.This method performs the following steps:
- Builds the server configuration to locate CATALINA_BASE
- Checks for a PID file in CATALINA_BASE
- If PID file exists, terminates the process by PID
- If no PID file exists, attempts to stop via catalina script
- Cleans up the PID file after successful stop
- Throws:
MojoExecutionException- if an error occurs during executionMojoFailureException- if execution fails due to invalid configuration
-