Package io.github.rajendarreddyj.tomcat
Class RunMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.github.rajendarreddyj.tomcat.AbstractTomcatMojo
io.github.rajendarreddyj.tomcat.RunMojo
- All Implemented Interfaces:
ContextEnabled,Mojo
@Mojo(name="run",
defaultPhase=PRE_INTEGRATION_TEST,
requiresDependencyResolution=RUNTIME,
threadSafe=true)
public class RunMojo
extends AbstractTomcatMojo
Runs Apache Tomcat in foreground mode with the project's webapp deployed.
This goal starts Tomcat and blocks until the process is terminated (Ctrl+C). The webapp is deployed to Tomcat's webapps directory before startup. If auto-publish is enabled, file changes in the source directory will trigger automatic redeployment.
Usage
mvn tomcat:run
Configuration Example
<plugin>
<groupId>io.github.rajendarreddyj</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<httpPort>8080</httpPort>
<contextPath>/myapp</contextPath>
<autopublishEnabled>true</autopublishEnabled>
</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
-
RunMojo
public RunMojo()
-
-
Method Details
-
execute
Executes the run goal.This method performs the following steps:
- Validates Java version compatibility with the configured Tomcat version
- Validates that the configured HTTP port is available
- Builds server and deployment configurations
- Deploys the webapp to Tomcat's webapps directory
- Starts the hot deploy watcher if auto-publish is enabled
- Starts Tomcat in foreground mode and blocks until shutdown
- Throws:
MojoExecutionException- if an error occurs during executionMojoFailureException- if execution fails due to invalid configuration
-