This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/tomcat-maven-plugin.git
The following commit(s) were added to refs/heads/trunk by this push:
new 17e71fe Javadoc warning fixes
17e71fe is described below
commit 17e71fe0a7b303d7fb132130fe044a141d55e281
Author: remm <[email protected]>
AuthorDate: Thu May 7 15:56:16 2026 +0200
Javadoc warning fixes
Coauthored by OpenCode.
---
.../maven/common/deployer/TomcatManager.java | 10 +-
.../common/deployer/TomcatManagerResponse.java | 33 ++++++-
.../common/messages/DefaultMessagesProvider.java | 10 +-
.../maven/common/messages/MessagesProvider.java | 11 +++
.../common/run/ClassLoaderEntriesCalculator.java | 9 +-
.../run/ClassLoaderEntriesCalculatorRequest.java | 55 ++++++++++-
.../run/ClassLoaderEntriesCalculatorResult.java | 30 +++++-
.../run/DefaultClassLoaderEntriesCalculator.java | 16 +++-
.../maven/common/run/TomcatRunException.java | 8 +-
.../maven/plugin/tomcat/AbstractCatalinaMojo.java | 6 ++
.../maven/plugin/tomcat/AbstractTomcatMojo.java | 19 +++-
.../plugin/tomcat/AbstractWarCatalinaMojo.java | 9 +-
.../plugin/tomcat/deploy/AbstractDeployMojo.java | 8 +-
.../tomcat/deploy/AbstractDeployWarMojo.java | 9 +-
.../maven/plugin/tomcat/deploy/DeployMojo.java | 9 +-
.../maven/plugin/tomcat/deploy/DeployOnlyMojo.java | 9 +-
.../maven/plugin/tomcat/deploy/ListMojo.java | 7 ++
.../maven/plugin/tomcat/deploy/RedeployMojo.java | 9 +-
.../plugin/tomcat/deploy/RedeployOnlyMojo.java | 7 ++
.../maven/plugin/tomcat/deploy/ReloadMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/ResourcesMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/ServerInfoMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/SessionsMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/StartMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/StopMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/UndeployMojo.java | 6 ++
.../maven/plugin/tomcat/deploy/WaitMojo.java | 6 ++
.../plugin/tomcat/run/AbstractExecWarMojo.java | 71 ++++++++++++++-
.../maven/plugin/tomcat/run/AbstractRunMojo.java | 60 +++++++++++-
.../plugin/tomcat/run/AbstractRunWarMojo.java | 7 ++
.../tomcat/run/AbstractStandaloneWarMojo.java | 20 +++-
.../maven/plugin/tomcat/run/ExecWarMojo.java | 11 ++-
.../maven/plugin/tomcat/run/ExecWarOnlyMojo.java | 9 +-
.../maven/plugin/tomcat/run/ExtendedTomcat.java | 8 +-
.../maven/plugin/tomcat/run/ExtraDependency.java | 12 ++-
.../maven/plugin/tomcat/run/ExtraResource.java | 11 ++-
.../tomcat/maven/plugin/tomcat/run/RunMojo.java | 14 ++-
.../tomcat/maven/plugin/tomcat/run/RunWarMojo.java | 7 +-
.../maven/plugin/tomcat/run/RunWarOnlyMojo.java | 7 +-
.../maven/plugin/tomcat/run/ShutdownMojo.java | 8 +-
.../maven/plugin/tomcat/run/StandaloneWarMojo.java | 7 +-
.../plugin/tomcat/run/StandaloneWarOnlyMojo.java | 7 +-
.../maven/plugin/tomcat/run/WarRunDependency.java | 15 ++-
.../tomcat/maven/plugin/tomcat/run/Webapp.java | 79 ++++++++++++++++
.../apache/tomcat/maven/runner/PasswordUtil.java | 29 +++++-
.../apache/tomcat/maven/runner/TomcatRunner.java | 101 ++++++++++++++++++++-
.../tomcat/maven/runner/TomcatRunnerCli.java | 22 ++++-
47 files changed, 778 insertions(+), 49 deletions(-)
diff --git
a/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManager.java
b/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManager.java
index ad759ff..315bc17 100644
--- a/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManager.java
+++ b/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManager.java
@@ -677,9 +677,10 @@ public class TomcatManager {
*
* @param path the Tomcat manager command to invoke
* @param data file to deploy
- *
+ * @param length the size of the data file to deploy
+ *
* @return the Tomcat manager response
- *
+ *
* @throws TomcatManagerException if the Tomcat manager request fails
* @throws IOException if an i/o error occurs
*/
@@ -766,6 +767,11 @@ public class TomcatManager {
.setHttpResponseBody(responseBody);
}
+ /**
+ * Calculates the relocated URL from the HTTP response Location header.
+ * @param connection the HTTP connection
+ * @return the relocated URL
+ */
protected String calculateRelocatedUrl(HttpURLConnection connection) {
String locationField = connection.getHeaderField("Location");
// is it a relative Location or a full ?
diff --git
a/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManagerResponse.java
b/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManagerResponse.java
index aca93f9..14c7e67 100644
---
a/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManagerResponse.java
+++
b/src/main/java/org/apache/tomcat/maven/common/deployer/TomcatManagerResponse.java
@@ -19,8 +19,9 @@
package org.apache.tomcat.maven.common.deployer;
/**
+ * Response object for Tomcat manager operations.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class TomcatManagerResponse {
@@ -30,32 +31,62 @@ public class TomcatManagerResponse {
private String httpResponseBody;
+ /**
+ * Creates an instance of TomcatManagerResponse.
+ */
public TomcatManagerResponse() {
// no op
}
+ /**
+ * Returns the HTTP status code.
+ * @return the status code
+ */
public int getStatusCode() {
return statusCode;
}
+ /**
+ * Sets the HTTP status code.
+ * @param statusCode the status code
+ * @return this response for chaining
+ */
public TomcatManagerResponse setStatusCode(int statusCode) {
this.statusCode = statusCode;
return this;
}
+ /**
+ * Returns the HTTP reason phrase.
+ * @return the reason phrase
+ */
public String getReasonPhrase() {
return reasonPhrase;
}
+ /**
+ * Sets the HTTP reason phrase.
+ * @param reasonPhrase the reason phrase
+ * @return this response for chaining
+ */
public TomcatManagerResponse setReasonPhrase(String reasonPhrase) {
this.reasonPhrase = reasonPhrase;
return this;
}
+ /**
+ * Returns the HTTP response body.
+ * @return the response body
+ */
public String getHttpResponseBody() {
return httpResponseBody;
}
+ /**
+ * Sets the HTTP response body.
+ * @param httpResponseBody the response body
+ * @return this response for chaining
+ */
public TomcatManagerResponse setHttpResponseBody(String httpResponseBody) {
this.httpResponseBody = httpResponseBody;
return this;
diff --git
a/src/main/java/org/apache/tomcat/maven/common/messages/DefaultMessagesProvider.java
b/src/main/java/org/apache/tomcat/maven/common/messages/DefaultMessagesProvider.java
index 8f87b96..7f32866 100644
---
a/src/main/java/org/apache/tomcat/maven/common/messages/DefaultMessagesProvider.java
+++
b/src/main/java/org/apache/tomcat/maven/common/messages/DefaultMessagesProvider.java
@@ -25,8 +25,9 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
+ * Default implementation of {@link MessagesProvider} that loads messages from
a ResourceBundle.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
@Component(role = MessagesProvider.class)
@@ -38,12 +39,19 @@ public class DefaultMessagesProvider implements
MessagesProvider {
private final ResourceBundle messages;
+ /**
+ * Creates a new instance and loads the message bundle.
+ */
public DefaultMessagesProvider() {
String packageName = getClass().getPackage().getName();
messages = ResourceBundle.getBundle(packageName + ".messages");
}
+ /**
+ * Returns the underlying resource bundle.
+ * @return the resource bundle
+ */
public ResourceBundle getResourceBundle() {
return this.messages;
}
diff --git
a/src/main/java/org/apache/tomcat/maven/common/messages/MessagesProvider.java
b/src/main/java/org/apache/tomcat/maven/common/messages/MessagesProvider.java
index 6effa4a..111ed2d 100644
---
a/src/main/java/org/apache/tomcat/maven/common/messages/MessagesProvider.java
+++
b/src/main/java/org/apache/tomcat/maven/common/messages/MessagesProvider.java
@@ -26,8 +26,19 @@ package org.apache.tomcat.maven.common.messages;
* @since 2.0
*/
public interface MessagesProvider {
+ /**
+ * Returns the message for the given key.
+ * @param key the message key
+ * @return the message string
+ */
String getMessage(String key);
+ /**
+ * Returns the formatted message for the given key with the specified
parameters.
+ * @param key the message key
+ * @param param1 the formatting parameters
+ * @return the formatted message string
+ */
String getMessage(String key, Object... param1);
}
diff --git
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculator.java
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculator.java
index a496064..3693cf3 100644
---
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculator.java
+++
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculator.java
@@ -19,11 +19,18 @@
package org.apache.tomcat.maven.common.run;
/**
+ * Calculator for determining classpath entries for the Tomcat webapp
classloader.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public interface ClassLoaderEntriesCalculator {
+ /**
+ * Calculates the classpath entries for the classloader.
+ * @param classLoaderEntriesCalculatorRequest the request containing
project and dependency information
+ * @return the result with classpath entries, temporary directories, and
build directories
+ * @throws TomcatRunException if calculation fails
+ */
ClassLoaderEntriesCalculatorResult calculateClassPathEntries(
ClassLoaderEntriesCalculatorRequest
classLoaderEntriesCalculatorRequest) throws TomcatRunException;
}
diff --git
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java
index 95e5c82..49f9c26 100644
---
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java
+++
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java
@@ -25,11 +25,19 @@ import org.apache.maven.project.MavenProject;
import java.util.Set;
/**
+ * Request object for classloader entries calculation.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class ClassLoaderEntriesCalculatorRequest {
+ /**
+ * Creates an instance of ClassLoaderEntriesCalculatorRequest.
+ */
+ public ClassLoaderEntriesCalculatorRequest() {
+ // default constructor
+ }
+
private MavenProject mavenProject;
private Set<Artifact> dependencies;
@@ -40,47 +48,92 @@ public class ClassLoaderEntriesCalculatorRequest {
private boolean useTestClassPath;
+ /**
+ * Returns the Maven project.
+ * @return the Maven project
+ */
public MavenProject getMavenProject() {
return mavenProject;
}
+ /**
+ * Sets the Maven project.
+ * @param mavenProject the Maven project
+ * @return this request for chaining
+ */
public ClassLoaderEntriesCalculatorRequest setMavenProject(MavenProject
mavenProject) {
this.mavenProject = mavenProject;
return this;
}
+ /**
+ * Returns the set of dependencies.
+ * @return the dependencies
+ */
public Set<Artifact> getDependencies() {
return dependencies;
}
+ /**
+ * Sets the dependencies.
+ * @param dependencies the dependencies
+ * @return this request for chaining
+ */
public ClassLoaderEntriesCalculatorRequest setDependencies(Set<Artifact>
dependencies) {
this.dependencies = dependencies;
return this;
}
+ /**
+ * Returns the log instance.
+ * @return the log
+ */
public Log getLog() {
return log;
}
+ /**
+ * Sets the log instance.
+ * @param log the log
+ * @return this request for chaining
+ */
public ClassLoaderEntriesCalculatorRequest setLog(Log log) {
this.log = log;
return this;
}
+ /**
+ * Returns whether WAR dependencies should be added to the classloader.
+ * @return true if WAR dependencies should be added
+ */
public boolean isAddWarDependenciesInClassloader() {
return addWarDependenciesInClassloader;
}
+ /**
+ * Sets whether WAR dependencies should be added to the classloader.
+ * @param addWarDependenciesInClassloader the flag value
+ * @return this request for chaining
+ */
public ClassLoaderEntriesCalculatorRequest
setAddWarDependenciesInClassloader(
boolean addWarDependenciesInClassloader) {
this.addWarDependenciesInClassloader = addWarDependenciesInClassloader;
return this;
}
+ /**
+ * Returns whether the test classpath should be used.
+ * @return true if test classpath should be used
+ */
public boolean isUseTestClassPath() {
return useTestClassPath;
}
+ /**
+ * Sets whether the test classpath should be used.
+ * @param useTestClassPath the flag value
+ * @return this request for chaining
+ */
public ClassLoaderEntriesCalculatorRequest setUseTestClassPath(boolean
useTestClassPath) {
this.useTestClassPath = useTestClassPath;
return this;
diff --git
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorResult.java
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorResult.java
index 6c750de..0c9ea2d 100644
---
a/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorResult.java
+++
b/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorResult.java
@@ -22,8 +22,9 @@ import java.io.File;
import java.util.List;
/**
+ * Result object for classloader entries calculation.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class ClassLoaderEntriesCalculatorResult {
@@ -44,9 +45,10 @@ public class ClassLoaderEntriesCalculatorResult {
private final List<String> buildDirectories;
/**
- * @param classPathEntries Classpath entries File .toURI().toString()
- * @param tmpDirectories List of files to cleanup after execution
- * @param buildDirectories Directory part of webapp classpath
(project.build.directory and reactor projects)
+ * Creates a new result with the given classpath entries, temporary
directories, and build directories.
+ * @param classPathEntries classpath entries as File.toURI().toString()
values
+ * @param tmpDirectories list of files to cleanup after execution
+ * @param buildDirectories directory part of webapp classpath
(project.build.directory and reactor projects)
*/
public ClassLoaderEntriesCalculatorResult(List<String> classPathEntries,
List<File> tmpDirectories,
List<String> buildDirectories) {
@@ -55,22 +57,42 @@ public class ClassLoaderEntriesCalculatorResult {
this.buildDirectories = buildDirectories;
}
+ /**
+ * Returns the classpath entries.
+ * @return the classpath entries
+ */
public List<String> getClassPathEntries() {
return classPathEntries;
}
+ /**
+ * Sets the classpath entries.
+ * @param classPathEntries the classpath entries
+ */
public void setClassPathEntries(List<String> classPathEntries) {
this.classPathEntries = classPathEntries;
}
+ /**
+ * Returns the temporary directories to clean up.
+ * @return the temporary directories
+ */
public List<File> getTmpDirectories() {
return tmpDirectories;
}
+ /**
+ * Sets the temporary directories.
+ * @param tmpDirectories the temporary directories
+ */
public void setTmpDirectories(List<File> tmpDirectories) {
this.tmpDirectories = tmpDirectories;
}
+ /**
+ * Returns the build directories.
+ * @return the build directories
+ */
public List<String> getBuildDirectories() {
return buildDirectories;
}
diff --git
a/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
b/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
index f781f8b..494b1b3 100644
---
a/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
+++
b/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
@@ -41,12 +41,20 @@ import java.util.List;
import java.util.Set;
/**
+ * Default implementation of {@link ClassLoaderEntriesCalculator} that
calculates classpath entries
+ * from Maven project dependencies.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
@Component(role = ClassLoaderEntriesCalculator.class)
public class DefaultClassLoaderEntriesCalculator implements
ClassLoaderEntriesCalculator {
+ /**
+ * Creates an instance of DefaultClassLoaderEntriesCalculator.
+ */
+ public DefaultClassLoaderEntriesCalculator() {
+ // default constructor
+ }
@Requirement
private ArchiverManager archiverManager;
@@ -204,6 +212,12 @@ public class DefaultClassLoaderEntriesCalculator
implements ClassLoaderEntriesCa
}
}
+ /**
+ * Checks if the given artifact is referenced by the project's reactor
projects.
+ * @param artifact the artifact to check
+ * @param project the Maven project
+ * @return true if the artifact is in the project references
+ */
protected boolean isInProjectReferences(Artifact artifact, MavenProject
project) {
if (project.getProjectReferences() == null ||
project.getProjectReferences().isEmpty()) {
return false;
diff --git
a/src/main/java/org/apache/tomcat/maven/common/run/TomcatRunException.java
b/src/main/java/org/apache/tomcat/maven/common/run/TomcatRunException.java
index eab7503..4e60a23 100644
--- a/src/main/java/org/apache/tomcat/maven/common/run/TomcatRunException.java
+++ b/src/main/java/org/apache/tomcat/maven/common/run/TomcatRunException.java
@@ -19,13 +19,19 @@
package org.apache.tomcat.maven.common.run;
/**
+ * Exception thrown during Tomcat run operations.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class TomcatRunException extends Exception {
private static final long serialVersionUID = 1L;
+ /**
+ * Creates an instance of TomcatRunException.
+ * @param s the detail message
+ * @param throwable the cause
+ */
public TomcatRunException(String s, Throwable throwable) {
super(s, throwable);
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractCatalinaMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractCatalinaMojo.java
index 766965b..134fb6e 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractCatalinaMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractCatalinaMojo.java
@@ -37,6 +37,12 @@ import java.util.StringTokenizer;
* @author Mark Hobson ([email protected])
*/
public abstract class AbstractCatalinaMojo extends AbstractTomcatMojo {
+ /**
+ * Creates an instance of AbstractCatalinaMojo.
+ */
+ protected AbstractCatalinaMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractTomcatMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractTomcatMojo.java
index a000f62..8a56f7e 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractTomcatMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractTomcatMojo.java
@@ -27,14 +27,27 @@ import
org.apache.tomcat.maven.common.deployer.TomcatManagerResponse;
import org.apache.tomcat.maven.common.messages.MessagesProvider;
/**
+ * Abstract base Mojo for Tomcat plugin goals.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public abstract class AbstractTomcatMojo extends AbstractMojo {
+ /**
+ * Creates an instance of AbstractTomcatMojo.
+ */
+ protected AbstractTomcatMojo() {
+ // default constructor
+ }
+ /**
+ * Maven settings.
+ */
@Parameter(defaultValue = "${settings}", readonly = true)
protected Settings settings;
+ /**
+ * Provider for localized messages.
+ */
@Component
protected MessagesProvider messagesProvider;
@@ -50,6 +63,10 @@ public abstract class AbstractTomcatMojo extends
AbstractMojo {
protected String path;
+ /**
+ * Returns the webapp context path.
+ * @return the context path
+ */
protected String getPath() {
return path;
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractWarCatalinaMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractWarCatalinaMojo.java
index 4e2f6bf..ab21b15 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractWarCatalinaMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/AbstractWarCatalinaMojo.java
@@ -22,11 +22,18 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
/**
- * Abstract goal that provides common configuration for Catalina-based goals.
+ * Abstract goal that provides common configuration for WAR-based Catalina
goals.
+ * Adds packaging validation for WAR projects.
*
* @author Mark Hobson ([email protected])
*/
public abstract class AbstractWarCatalinaMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of AbstractWarCatalinaMojo.
+ */
+ protected AbstractWarCatalinaMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployMojo.java
index c316435..d70972f 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployMojo.java
@@ -29,11 +29,17 @@ import java.io.IOException;
import java.net.URL;
/**
- * Deploy a WAR to Tomcat.
+ * Abstract base for deploy goals. Supports WAR, context XML, or both
deployment modes.
*
* @author Mark Hobson ([email protected])
*/
public abstract class AbstractDeployMojo extends AbstractWarCatalinaMojo {
+ /**
+ * Creates an instance of AbstractDeployMojo.
+ */
+ protected AbstractDeployMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployWarMojo.java
index 76626d7..61c00b2 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployWarMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/AbstractDeployWarMojo.java
@@ -27,11 +27,18 @@ import java.io.File;
import java.io.IOException;
/**
+ * Abstract deploy goal that deploys a WAR file to Tomcat.
+ *
* @author olamy
- *
* @since 1.0-alpha-2
*/
public class AbstractDeployWarMojo extends AbstractDeployMojo {
+ /**
+ * Creates an instance of AbstractDeployWarMojo.
+ */
+ public AbstractDeployWarMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployMojo.java
index 9eb7af7..0e6cb1d 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployMojo.java
@@ -23,12 +23,17 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
/**
- * Deploy a WAR to Tomcat.
+ * Deploy a WAR to Tomcat. Executes after the package phase.
*
* @author Mark Hobson ([email protected])
*/
@Mojo(name = "deploy", threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class DeployMojo extends AbstractDeployWarMojo {
- // no-op : only mojo metadata overriding
+ /**
+ * Creates an instance of DeployMojo.
+ */
+ public DeployMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployOnlyMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployOnlyMojo.java
index 472a8dd..c5d7f52 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployOnlyMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/DeployOnlyMojo.java
@@ -22,12 +22,17 @@ import org.apache.maven.plugins.annotations.Mojo;
/**
* Deploy a WAR to Tomcat without forking the package lifecycle.
+ * Use this goal when the WAR is already built and you only want to deploy.
*
* @author olamy
- *
* @since 1.0-alpha-2
*/
@Mojo(name = "deploy-only", threadSafe = true)
public class DeployOnlyMojo extends AbstractDeployWarMojo {
- // no-op : only mojo metadata overriding
+ /**
+ * Creates an instance of DeployOnlyMojo.
+ */
+ public DeployOnlyMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ListMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ListMojo.java
index 896ae65..c869b26 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ListMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ListMojo.java
@@ -27,11 +27,18 @@ import java.io.IOException;
/**
* List all web applications currently running in Tomcat.
+ * Connects to the Tomcat manager and lists all deployed applications with
their status.
*
* @since 3.0
*/
@Mojo(name = "list", threadSafe = true)
public class ListMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of ListMojo.
+ */
+ public ListMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployMojo.java
index 9cc5268..7207a71 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployMojo.java
@@ -26,12 +26,19 @@ import org.apache.maven.plugins.annotations.Mojo;
* Redeploy a WAR in Tomcat. (Alias for the deploy goal with its update
parameter set to true.)
*
* @author Olivier Lamy
- *
+ *
* @since 2.1
*/
@Mojo(name = "redeploy", threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class RedeployMojo extends DeployMojo {
+ /**
+ * Creates an instance of RedeployMojo.
+ */
+ public RedeployMojo() {
+ // default constructor
+ }
+
@Override
protected boolean isUpdate() {
return true;
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployOnlyMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployOnlyMojo.java
index 819fe8a..9376767 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployOnlyMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/RedeployOnlyMojo.java
@@ -28,6 +28,13 @@ import org.apache.maven.plugins.annotations.Mojo;
*/
@Mojo(name = "redeploy-only", threadSafe = true)
public class RedeployOnlyMojo extends DeployOnlyMojo {
+ /**
+ * Creates an instance of RedeployOnlyMojo.
+ */
+ public RedeployOnlyMojo() {
+ // default constructor
+ }
+
@Override
protected boolean isUpdate() {
return true;
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ReloadMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ReloadMojo.java
index 2611f1b..309407c 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ReloadMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ReloadMojo.java
@@ -33,6 +33,12 @@ import java.io.IOException;
*/
@Mojo(name = "reload", threadSafe = true)
public class ReloadMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of ReloadMojo.
+ */
+ public ReloadMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ResourcesMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ResourcesMojo.java
index 5a8d350..1af54e4 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ResourcesMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ResourcesMojo.java
@@ -33,6 +33,12 @@ import java.io.IOException;
*/
@Mojo(name = "resources", threadSafe = true)
public class ResourcesMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of ResourcesMojo.
+ */
+ public ResourcesMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ServerInfoMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ServerInfoMojo.java
index 7c5f70b..146f681 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ServerInfoMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/ServerInfoMojo.java
@@ -32,6 +32,12 @@ import java.io.IOException;
*/
@Mojo(name = "serverinfo", threadSafe = true)
public class ServerInfoMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of ServerInfoMojo.
+ */
+ public ServerInfoMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/SessionsMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/SessionsMojo.java
index d0f02b5..576cc05 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/SessionsMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/SessionsMojo.java
@@ -32,6 +32,12 @@ import java.io.IOException;
*/
@Mojo(name = "sessions", threadSafe = true)
public class SessionsMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of SessionsMojo.
+ */
+ public SessionsMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StartMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StartMojo.java
index 25d77d7..dbedc81 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StartMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StartMojo.java
@@ -33,6 +33,12 @@ import java.io.IOException;
*/
@Mojo(name = "start", threadSafe = true)
public class StartMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of StartMojo.
+ */
+ public StartMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StopMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StopMojo.java
index ab5776c..5347d0a 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StopMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/StopMojo.java
@@ -33,6 +33,12 @@ import java.io.IOException;
*/
@Mojo(name = "stop", threadSafe = true)
public class StopMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of StopMojo.
+ */
+ public StopMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/UndeployMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/UndeployMojo.java
index fdf83ee..7a73778 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/UndeployMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/UndeployMojo.java
@@ -34,6 +34,12 @@ import java.io.IOException;
*/
@Mojo(name = "undeploy", threadSafe = true)
public class UndeployMojo extends AbstractWarCatalinaMojo {
+ /**
+ * Creates an instance of UndeployMojo.
+ */
+ public UndeployMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/WaitMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/WaitMojo.java
index 7635396..aef0454 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/WaitMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/deploy/WaitMojo.java
@@ -36,6 +36,12 @@ import java.util.concurrent.TimeUnit;
*/
@Mojo(name = "wait", threadSafe = true)
public class WaitMojo extends AbstractCatalinaMojo {
+ /**
+ * Creates an instance of WaitMojo.
+ */
+ public WaitMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractExecWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractExecWarMojo.java
index 0b53d05..2c7cd8d 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractExecWarMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractExecWarMojo.java
@@ -60,12 +60,23 @@ import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResult;
/**
+ * Abstract Mojo for building executable WAR/JAR files with embedded Tomcat.
+ * Bundles Tomcat classes and webapp into a self-contained executable archive.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public abstract class AbstractExecWarMojo extends AbstractTomcatMojo {
+ /**
+ * Creates an instance of AbstractExecWarMojo.
+ */
+ protected AbstractExecWarMojo() {
+ // default constructor
+ }
+ /**
+ * The project artifact.
+ */
@Parameter(defaultValue = "${project.artifact}", required = true, readonly
= true)
protected Artifact projectArtifact;
@@ -75,9 +86,15 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
@Parameter(defaultValue = "${project}", required = true, readonly = true)
protected MavenProject project;
+ /**
+ * The plugin artifacts.
+ */
@Parameter(defaultValue = "${plugin.artifacts}", required = true)
protected List<Artifact> pluginArtifacts;
+ /**
+ * The build directory.
+ */
@Parameter(defaultValue = "${project.build.directory}")
protected File buildDirectory;
@@ -87,9 +104,15 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
@Parameter(defaultValue =
"${project.build.directory}/tomcat-maven-plugin-exec")
private File pluginWorkDirectory;
+ /**
+ * Directory containing Tomcat configuration files.
+ */
@Parameter(property = "maven.tomcat.exec.war.tomcatConf", defaultValue =
"src/main/tomcatconf")
protected File tomcatConfigurationFilesDirectory;
+ /**
+ * Path to the server.xml configuration file.
+ */
@Parameter(defaultValue = "src/main/tomcatconf/server.xml", property =
"maven.tomcat.exec.war.serverXml")
protected File serverXml;
@@ -114,9 +137,15 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
@Parameter(property = "maven.tomcat.path", defaultValue =
"${project.artifactId}", required = true)
protected String path;
+ /**
+ * List of WAR dependencies to embed.
+ */
@Parameter
protected List<WarRunDependency> warRunDependencies;
+ /**
+ * Aether repository system for artifact resolution.
+ */
@Component
protected RepositorySystem repositorySystem;
@@ -132,9 +161,15 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
@Parameter(defaultValue = "${project.remoteArtifactRepositories}",
required = true, readonly = true)
protected List<ArtifactRepository> remoteRepos;
+ /**
+ * Maven session.
+ */
@Parameter(defaultValue = "${session}", readonly = true, required = true)
protected org.apache.maven.execution.MavenSession session;
+ /**
+ * Maven project helper for attaching artifacts.
+ */
@Component
protected MavenProjectHelper projectHelper;
@@ -432,6 +467,11 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
}
}
+ /**
+ * Finds the version for a dependency by searching project dependencies
and dependency management.
+ * @param dependency the dependency to find the version for
+ * @return the version string, or null if not found
+ */
protected String findArtifactVersion(Dependency dependency) {
// search in project.dependencies
for (Dependency projectDependency : (List<Dependency>)
this.project.getDependencies()) {
@@ -450,11 +490,24 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
return null;
}
+ /**
+ * Checks if two dependencies are the same (ignoring version).
+ * @param that the first dependency
+ * @param dependency the second dependency
+ * @return true if groupId and artifactId match
+ */
protected boolean sameDependencyWithoutVersion(Dependency that, Dependency
dependency) {
return that.getGroupId() != null &&
that.getGroupId().equals(dependency.getGroupId()) &&
that.getArtifactId() != null &&
that.getArtifactId().equals(dependency.getArtifactId());
}
+ /**
+ * Copies all files from a directory into the archive.
+ * @param sourceFolder the source directory
+ * @param destinationPath the destination path within the archive
+ * @param archiveOutputStream the archive output stream
+ * @throws IOException if an I/O error occurs
+ */
protected void copyDirectoryContentIntoArchive(File sourceFolder, String
destinationPath,
ArchiveOutputStream<JarArchiveEntry> archiveOutputStream) throws
IOException {
@@ -500,6 +553,11 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
}
+ /**
+ * Converts a list to a string array.
+ * @param list the list to convert
+ * @return the string array, or empty array if the list is null/empty
+ */
protected String[] toStringArray(List<String> list) {
if (list == null || list.isEmpty()) {
return new String[0];
@@ -514,7 +572,12 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
/**
- * return file can be deleted
+ * Adds a context.xml file to a WAR archive.
+ * @param contextXmlFile the context XML file to add
+ * @param warFile the source WAR file
+ * @return the new WAR file with the context.xml added
+ * @throws IOException if an I/O error occurs
+ * @throws ArchiveException if an archive error occurs
*/
protected File addContextXmlToWar(File contextXmlFile, File warFile)
throws IOException, ArchiveException {
ArchiveOutputStream<JarArchiveEntry> os = null;
@@ -544,8 +607,8 @@ public abstract class AbstractExecWarMojo extends
AbstractTomcatMojo {
*
* @param file The input jar file
* @param os The output archive
- *
- * @throws IOException
+ * @param excludes file patterns to exclude
+ * @throws IOException if an I/O error occurs
*/
protected void extractJarToArchive(JarFile file,
ArchiveOutputStream<JarArchiveEntry> os, String[] excludes)
throws IOException {
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunMojo.java
index 6a48051..f9ccbf6 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunMojo.java
@@ -94,11 +94,19 @@ import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/**
+ * Abstract Mojo for running a web application with embedded Tomcat.
+ * Provides configuration for ports, SSL, connectors, and context management.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public abstract class AbstractRunMojo extends AbstractTomcatMojo {
+ /**
+ * Creates an instance of AbstractRunMojo.
+ */
+ protected AbstractRunMojo() {
+ // default constructor
+ }
// ---------------------------------------------------------------------
// Mojo Components
// ---------------------------------------------------------------------
@@ -109,6 +117,9 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
@Parameter(defaultValue = "${localRepository}", required = true, readonly
= true)
private ArtifactRepository local;
+ /**
+ * Aether repository system for artifact resolution.
+ */
@Component
protected RepositorySystem repositorySystem;
@@ -441,6 +452,9 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
@Parameter
protected String classLoaderClass;
+ /**
+ * Maven session.
+ */
@Parameter(defaultValue = "${session}", readonly = true, required = true)
protected MavenSession session;
@@ -476,6 +490,9 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
@Parameter(property = "maven.tomcat.https.clientAuth", defaultValue =
"false")
protected String clientAuth = "false";
+ /**
+ * Maven file filter for resource filtering.
+ */
@Component(role = MavenFileFilter.class, hint = "default")
protected MavenFileFilter mavenFileFilter;
@@ -490,48 +507,56 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
protected boolean jarScanAllDirectories = true;
/**
+ * Use body encoding for URI decoding.
* @since 2.2
*/
@Parameter(property = "maven.tomcat.useBodyEncodingForURI", defaultValue =
"false")
protected boolean useBodyEncodingForURI;
/**
+ * Trust manager class name for SSL.
* @since 2.2
*/
@Parameter
protected String trustManagerClassName;
/**
+ * Maximum certificate chain length for SSL.
* @since 2.2
*/
@Parameter
protected String trustMaxCertLength;
/**
+ * Truststore algorithm for SSL.
* @since 2.2
*/
@Parameter
protected String truststoreAlgorithm;
/**
+ * Truststore file path for SSL.
* @since 2.2
*/
@Parameter
protected String truststoreFile;
/**
+ * Truststore password for SSL.
* @since 2.2
*/
@Parameter
protected String truststorePass;
/**
+ * Truststore provider for SSL.
* @since 2.2
*/
@Parameter
protected String truststoreProvider;
/**
+ * Truststore type for SSL.
* @since 2.2
*/
@Parameter
@@ -542,6 +567,7 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
// ----------------------------------------------------------------------
/**
+ * Separate classloader realm for Tomcat.
* @since 1.0
*/
private ClassRealm tomcatRealm;
@@ -611,6 +637,11 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
}
}
+ /**
+ * Enhances the Tomcat context with additional configuration. Override to
customize context setup.
+ * @param context the Tomcat context to enhance
+ * @throws MojoExecutionException if enhancement fails
+ */
protected void enhanceContext(final Context context) throws
MojoExecutionException {
// no op
}
@@ -694,6 +725,12 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
}
+ /**
+ * Parses a context XML file to extract path and docBase attributes.
+ * @param file the context XML file
+ * @return the parsed StandardContext
+ * @throws MojoExecutionException if parsing fails
+ */
protected StandardContext parseContextFile(File file) throws
MojoExecutionException {
try {
StandardContext standardContext = new StandardContext();
@@ -743,6 +780,12 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
*
* @return false by default, true if reloadable="true" in context.xml.
*/
+ /**
+ * Determine whether the passed context.xml file declares the context as
reloadable or not.
+ *
+ * @return false by default, true if reloadable="true" in context.xml.
+ * @throws MojoExecutionException if an error occurs
+ */
protected boolean isContextReloadable() throws MojoExecutionException {
if (contextReloadable || backgroundProcessorDelay > 0) {
return true;
@@ -778,12 +821,18 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
*
* @return the webapp directory
*/
+ /**
+ * Gets the webapp directory to run.
+ * @return the webapp directory
+ * @throws IOException if an I/O error occurs
+ */
protected abstract File getDocBase() throws IOException;
/**
* Gets the Tomcat context XML file to use.
*
* @return the context XML file
+ * @throws MojoExecutionException if an error occurs
*/
protected abstract File getContextFile() throws MojoExecutionException;
@@ -1149,6 +1198,11 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
return webapps;
}
+ /**
+ * Gets or creates the Tomcat classloader realm.
+ * @return the classloader realm
+ * @throws MojoExecutionException if the classloader cannot be created
+ */
protected ClassRealm getTomcatClassLoader() throws MojoExecutionException {
if (this.tomcatRealm != null) {
return tomcatRealm;
@@ -1173,6 +1227,10 @@ public abstract class AbstractRunMojo extends
AbstractTomcatMojo {
}
}
+ /**
+ * Gets the project artifacts.
+ * @return the set of project artifacts
+ */
public Set<Artifact> getProjectArtifacts() {
return project.getArtifacts();
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunWarMojo.java
index 15a6def..d890256 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunWarMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractRunWarMojo.java
@@ -24,10 +24,17 @@ import java.io.File;
/**
* Runs the current project as a packaged web application using an embedded
Tomcat server.
+ * Configures the docbase from the WAR directory and context file.
*
* @author Mark Hobson ([email protected])
*/
public abstract class AbstractRunWarMojo extends AbstractRunMojo {
+ /**
+ * Creates an instance of AbstractRunWarMojo.
+ */
+ protected AbstractRunWarMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractStandaloneWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractStandaloneWarMojo.java
index e6873db..3b74a8d 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractStandaloneWarMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/AbstractStandaloneWarMojo.java
@@ -50,11 +50,18 @@ import org.codehaus.plexus.archiver.jar.ManifestException;
import org.codehaus.plexus.util.DirectoryScanner;
/**
- * Abstract Mojo for building deployable and executable war files
+ * Abstract Mojo for building deployable and executable standalone WAR files.
+ * Creates a self-contained WAR with embedded Tomcat that runs with {@code
java -jar}.
*
* @since 2.1
*/
public abstract class AbstractStandaloneWarMojo extends AbstractExecWarMojo {
+ /**
+ * Creates an instance of AbstractStandaloneWarMojo.
+ */
+ protected AbstractStandaloneWarMojo() {
+ // default constructor
+ }
/**
* Name of the generated WAR.
@@ -256,6 +263,17 @@ public abstract class AbstractStandaloneWarMojo extends
AbstractExecWarMojo {
}
+ /**
+ * Resolves a dependency artifact from remote repositories.
+ * @param groupId the artifact group ID
+ * @param artifactId the artifact ID
+ * @param version the artifact version
+ * @param type the artifact type
+ * @param classifier the artifact classifier
+ * @return the resolved Maven artifact
+ * @throws ArtifactResolutionException if the artifact cannot be resolved
+ * @throws IOException if an I/O error occurs
+ */
protected Artifact resolveDependencyArtifact(String groupId, String
artifactId, String version, String type,
String classifier) throws ArtifactResolutionException, IOException
{
org.eclipse.aether.artifact.Artifact aetherArtifact = new
DefaultArtifact(groupId, artifactId,
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarMojo.java
index 9a295b8..2431d05 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarMojo.java
@@ -24,15 +24,20 @@ import org.apache.maven.plugins.annotations.Mojo;
/**
* Create a self executable jar file containing all necessary Apache Tomcat
classes. This allows for using just
- * <code>java -jar mywebapp.jar</code> to run your webapp without needing to
install a Tomcat instance. More details
+ * {@code java -jar mywebapp.jar} to run your webapp without needing to
install a Tomcat instance. More details
* <a
href="http://tomcat.apache.org/maven-plugin-2.0/executable-war-jar.html">here</a>.
+ * Executes after the package phase.
*
* @author Olivier Lamy
- *
* @since 2.0
*/
@Mojo(name = "exec-war", threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class ExecWarMojo extends AbstractExecWarMojo {
- // no op only mojo metadatas
+ /**
+ * Creates an instance of ExecWarMojo.
+ */
+ public ExecWarMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarOnlyMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarOnlyMojo.java
index d9fe394..adfa1fe 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarOnlyMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExecWarOnlyMojo.java
@@ -22,12 +22,17 @@ import org.apache.maven.plugins.annotations.Mojo;
/**
* Same as exec-war goal without forking the package lifecycle.
+ * Use this goal when the WAR is already built and you only want to create the
executable JAR.
*
* @author Olivier Lamy
- *
* @since 2.0
*/
@Mojo(name = "exec-war-only", threadSafe = true)
public class ExecWarOnlyMojo extends AbstractExecWarMojo {
- // no op only mojo metadatas to not fork a lifecycle
+ /**
+ * Creates an instance of ExecWarOnlyMojo.
+ */
+ public ExecWarOnlyMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtendedTomcat.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtendedTomcat.java
index 2a85cac..66f26d4 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtendedTomcat.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtendedTomcat.java
@@ -26,14 +26,20 @@ import org.apache.catalina.startup.Tomcat;
import java.io.File;
/**
+ * Extended Tomcat embedding that customizes webapp configuration.
+ * Disables default web.xml and uses a custom web.xml from the configuration
directory.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class ExtendedTomcat extends Tomcat {
private File configurationDir;
+ /**
+ * Creates an extended Tomcat instance with the given configuration
directory.
+ * @param configurationDir the Tomcat configuration directory
+ */
public ExtendedTomcat(File configurationDir) {
super();
this.configurationDir = configurationDir;
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraDependency.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraDependency.java
index ec6cd72..29b3230 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraDependency.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraDependency.java
@@ -21,12 +21,20 @@ package org.apache.tomcat.maven.plugin.tomcat.run;
import org.apache.maven.model.Dependency;
/**
+ * Extra dependency to include in the standalone Tomcat JAR.
+ * Used for JDBC drivers, mail.jar, and other root classloader dependencies.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class ExtraDependency extends Dependency {
private static final long serialVersionUID = 1L;
- // no op just here to support for maven 2.x
+
+ /**
+ * Creates an instance of ExtraDependency.
+ */
+ public ExtraDependency() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraResource.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraResource.java
index 30d9291..176e7bf 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraResource.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ExtraResource.java
@@ -21,11 +21,20 @@ package org.apache.tomcat.maven.plugin.tomcat.run;
import org.apache.maven.model.Resource;
/**
+ * Extra resource to include in the standalone Tomcat JAR.
+ * Used for logger configuration and other resource files.
+ *
* @author Olivier Lamy
*/
public class ExtraResource extends Resource {
private static final long serialVersionUID = 1L;
- // no op just here to support for maven 2.x
+
+ /**
+ * Creates an instance of ExtraResource.
+ */
+ public ExtraResource() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunMojo.java
index 35fc5e0..071feab 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunMojo.java
@@ -64,12 +64,18 @@ import
org.codehaus.plexus.util.xml.pull.XmlPullParserException;
* Runs the current project as a dynamic web application using an embedded
Tomcat server.
*
* @author Olivier Lamy
- *
+ *
* @since 2.0
*/
@Mojo(name = "run", requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = true)
@Execute(phase = LifecyclePhase.PROCESS_CLASSES)
public class RunMojo extends AbstractRunMojo {
+ /**
+ * Creates an instance of RunMojo.
+ */
+ public RunMojo() {
+ // default constructor
+ }
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
@@ -131,6 +137,10 @@ public class RunMojo extends AbstractRunMojo {
private List<String> additionalClasspathDirs;
+ /**
+ * Returns the web resources directory for the web application being run.
+ * @return the web resources directory
+ */
public final File getWarSourceDirectory() {
return warSourceDirectory;
}
@@ -232,7 +242,7 @@ public class RunMojo extends AbstractRunMojo {
/**
* {@inheritDoc}
*
- * @throws MojoExecutionException
+ * @throws MojoExecutionException if the webapp loader could not be created
*/
@Override
protected WebappLoader createWebappLoader() throws IOException,
MojoExecutionException {
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarMojo.java
index a524f60..6e85e08 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarMojo.java
@@ -31,5 +31,10 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
@Mojo(name = "run-war", requiresDependencyResolution =
ResolutionScope.RUNTIME, threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class RunWarMojo extends AbstractRunWarMojo {
- // no-op : only mojo metadata overriding
+ /**
+ * Creates an instance of RunWarMojo.
+ */
+ public RunWarMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarOnlyMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarOnlyMojo.java
index dbe4a9e..9d527ea 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarOnlyMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/RunWarOnlyMojo.java
@@ -28,5 +28,10 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
*/
@Mojo(name = "run-war-only", requiresDependencyResolution =
ResolutionScope.RUNTIME, threadSafe = true)
public class RunWarOnlyMojo extends AbstractRunWarMojo {
- // no-op : only mojo metadata overriding
+ /**
+ * Creates an instance of RunWarOnlyMojo.
+ */
+ public RunWarOnlyMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ShutdownMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ShutdownMojo.java
index e8cd3ca..1aacaf7 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ShutdownMojo.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/ShutdownMojo.java
@@ -36,11 +36,17 @@ import
org.apache.tomcat.maven.plugin.tomcat.AbstractTomcatMojo;
* </p>
*
* @author Mark Michaelis
- *
+ *
* @since 2.0
*/
@Mojo(name = "shutdown", requiresDependencyResolution =
ResolutionScope.RUNTIME, threadSafe = true)
public class ShutdownMojo extends AbstractTomcatMojo {
+ /**
+ * Creates an instance of ShutdownMojo.
+ */
+ public ShutdownMojo() {
+ // default constructor
+ }
/**
* Ignore error when shutdown
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarMojo.java
index 3742e76..98436fb 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarMojo.java
@@ -30,5 +30,10 @@ import org.apache.maven.plugins.annotations.Mojo;
@Mojo(name = "standalone-war", threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class StandaloneWarMojo extends AbstractStandaloneWarMojo {
- // no op
+ /**
+ * Creates an instance of StandaloneWarMojo.
+ */
+ public StandaloneWarMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarOnlyMojo.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarOnlyMojo.java
index 5dd1eea..a5828c9 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarOnlyMojo.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/StandaloneWarOnlyMojo.java
@@ -27,5 +27,10 @@ import org.apache.maven.plugins.annotations.Mojo;
*/
@Mojo(name = "standalone-war-only", threadSafe = true)
public class StandaloneWarOnlyMojo extends AbstractStandaloneWarMojo {
- // no op
+ /**
+ * Creates an instance of StandaloneWarOnlyMojo.
+ */
+ public StandaloneWarOnlyMojo() {
+ // default constructor
+ }
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/WarRunDependency.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/WarRunDependency.java
index d60d10e..6e4301f 100644
---
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/WarRunDependency.java
+++
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/WarRunDependency.java
@@ -23,18 +23,31 @@ import org.apache.maven.model.Dependency;
import java.io.File;
/**
+ * Configuration for a WAR dependency to embed in an executable JAR.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class WarRunDependency {
+ /**
+ * The dependency descriptor.
+ */
public Dependency dependency;
+ /**
+ * The context path for the WAR.
+ */
public String contextPath;
+ /**
+ * The context XML file for the WAR.
+ */
public File contextXml;
+ /**
+ * Creates an instance of WarRunDependency.
+ */
public WarRunDependency() {
// no op
}
diff --git
a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/Webapp.java
b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/Webapp.java
index 59373c4..2d39b1a 100644
--- a/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/Webapp.java
+++ b/src/main/java/org/apache/tomcat/maven/plugin/tomcat/run/Webapp.java
@@ -76,10 +76,17 @@ public class Webapp {
private File contextFile;
private boolean asWebapp = false;
+ /**
+ * Creates an instance of Webapp.
+ */
public Webapp() {
// default constructor
}
+ /**
+ * Creates a Webapp from the given Maven artifact.
+ * @param artifact the Maven artifact
+ */
public Webapp(Artifact artifact) {
this.setArtifact(artifact);
this.setGroupId(artifact.getGroupId());
@@ -89,46 +96,90 @@ public class Webapp {
this.setType(artifact.getType());
}
+ /**
+ * Returns the Maven group ID.
+ * @return the group ID
+ */
public String getGroupId() {
return groupId;
}
+ /**
+ * Sets the Maven group ID.
+ * @param groupId the group ID
+ */
public void setGroupId(String groupId) {
this.groupId = groupId;
}
+ /**
+ * Returns the Maven artifact ID.
+ * @return the artifact ID
+ */
public String getArtifactId() {
return artifactId;
}
+ /**
+ * Sets the Maven artifact ID.
+ * @param artifactId the artifact ID
+ */
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
+ /**
+ * Returns the artifact version.
+ * @return the version
+ */
public String getVersion() {
return version;
}
+ /**
+ * Sets the artifact version.
+ * @param version the version
+ */
public void setVersion(String version) {
this.version = version;
}
+ /**
+ * Returns the artifact type.
+ * @return the type
+ */
public String getType() {
return type;
}
+ /**
+ * Sets the artifact type.
+ * @param type the type
+ */
public void setType(String type) {
this.type = type;
}
+ /**
+ * Returns the artifact classifier.
+ * @return the classifier
+ */
public String getClassifier() {
return classifier;
}
+ /**
+ * Sets the artifact classifier.
+ * @param classifier the classifier
+ */
public void setClassifier(String classifier) {
this.classifier = classifier;
}
+ /**
+ * Returns the context path for the webapp.
+ * @return the context path
+ */
public String getContextPath() {
if (contextPath == null || contextPath.isEmpty()) {
return this.artifactId;
@@ -136,30 +187,58 @@ public class Webapp {
return contextPath;
}
+ /**
+ * Sets the context path for the webapp.
+ * @param contextPath the context path
+ */
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
}
+ /**
+ * Returns the resolved Maven artifact.
+ * @return the artifact
+ */
public Artifact getArtifact() {
return artifact;
}
+ /**
+ * Sets the resolved Maven artifact.
+ * @param artifact the Maven artifact
+ */
public void setArtifact(Artifact artifact) {
this.artifact = artifact;
}
+ /**
+ * Sets the context XML file.
+ * @param contextFile the context file
+ */
public void setContextFile(File contextFile) {
this.contextFile = contextFile;
}
+ /**
+ * Returns the context XML file.
+ * @return the context file
+ */
public File getContextFile() {
return contextFile;
}
+ /**
+ * Returns whether the webapp should be added as a webapp context.
+ * @return true if added as a webapp
+ */
public boolean isAsWebapp() {
return asWebapp;
}
+ /**
+ * Sets whether the webapp should be added as a webapp context.
+ * @param asWebapp true if added as a webapp
+ */
public void setAsWebapp(boolean asWebapp) {
this.asWebapp = asWebapp;
}
diff --git a/src/main/java/org/apache/tomcat/maven/runner/PasswordUtil.java
b/src/main/java/org/apache/tomcat/maven/runner/PasswordUtil.java
index c272f19..23a8c11 100644
--- a/src/main/java/org/apache/tomcat/maven/runner/PasswordUtil.java
+++ b/src/main/java/org/apache/tomcat/maven/runner/PasswordUtil.java
@@ -41,9 +41,23 @@ import java.util.Properties;
* @since 2.0
*/
public class PasswordUtil {
+ /**
+ * Prefix for obfuscated passwords.
+ */
public static final String __OBFUSCATE = "OBF:";
- /* ------------------------------------------------------------ */
+ /**
+ * Creates an instance of PasswordUtil.
+ */
+ public PasswordUtil() {
+ // default constructor
+ }
+
+ /**
+ * Obfuscates the given password string.
+ * @param s the password to obfuscate
+ * @return the obfuscated password string
+ */
public static String obfuscate(String s) {
StringBuilder buf = new StringBuilder();
byte[] b = s.getBytes();
@@ -72,7 +86,11 @@ public class PasswordUtil {
}
- /* ------------------------------------------------------------ */
+ /**
+ * Deobfuscates the given obfuscated password string.
+ * @param s the obfuscated password string
+ * @return the deobfuscated password string, or the original if not
obfuscated
+ */
public static String deobfuscate(String s) {
if (s.startsWith(__OBFUSCATE)) {
s = s.substring(__OBFUSCATE.length());
@@ -93,6 +111,9 @@ public class PasswordUtil {
}
+ /**
+ * Deobfuscates all system properties that start with the obfuscation
prefix.
+ */
public static void deobfuscateSystemProps() {
Properties props = System.getProperties();
for (Object obj : props.keySet()) {
@@ -106,6 +127,10 @@ public class PasswordUtil {
}
}
+ /**
+ * Main entry point for command-line password obfuscation/deobfuscation.
+ * @param args command-line arguments
+ */
public static void main(String[] args) {
if (args[0].startsWith(__OBFUSCATE)) {
System.out.println(PasswordUtil.deobfuscate(args[1]));
diff --git a/src/main/java/org/apache/tomcat/maven/runner/TomcatRunner.java
b/src/main/java/org/apache/tomcat/maven/runner/TomcatRunner.java
index 0842f1f..ee0fb0e 100644
--- a/src/main/java/org/apache/tomcat/maven/runner/TomcatRunner.java
+++ b/src/main/java/org/apache/tomcat/maven/runner/TomcatRunner.java
@@ -57,18 +57,34 @@ import org.apache.tomcat.util.http.fileupload.FileUtils;
* @since 2.0
*/
public class TomcatRunner {
- // true/false to use the server.xml located in the jar /conf/server.xml
+ /**
+ * Property key to enable/disable server.xml usage.
+ */
public static final String USE_SERVER_XML_KEY = "useServerXml";
- // contains war name wars=foo.war,bar.war
+ /**
+ * Property key for WAR names.
+ */
public static final String WARS_KEY = "wars";
+ /**
+ * Property key for archive generation timestamp.
+ */
public static final String ARCHIVE_GENERATION_TIMESTAMP_KEY =
"generationTimestamp";
+ /**
+ * Property key to enable/disable naming.
+ */
public static final String ENABLE_NAMING_KEY = "enableNaming";
+ /**
+ * Property key for access log valve format.
+ */
public static final String ACCESS_LOG_VALVE_FORMAT_KEY =
"accessLogValveFormat";
+ /**
+ * Property key for code source context path.
+ */
public static final String CODE_SOURCE_CONTEXT_PATH =
"codeSourceContextPath";
/**
@@ -82,36 +98,84 @@ public class TomcatRunner {
public static final String HTTP_PORT_KEY = "httpPort";
+ /**
+ * HTTP port number.
+ */
public int httpPort;
+ /**
+ * HTTPS port number.
+ */
public int httpsPort;
+ /**
+ * Maximum POST size in bytes.
+ */
public int maxPostSize = 2097152;
+ /**
+ * AJP port number.
+ */
public int ajpPort;
+ /**
+ * Path to the server.xml configuration file.
+ */
public String serverXmlPath;
+ /**
+ * Runtime properties loaded from the standalone properties file.
+ */
public Properties runtimeProperties;
+ /**
+ * Whether to reset the extraction directory on startup.
+ */
public boolean resetExtract;
+ /**
+ * Whether debug mode is enabled.
+ */
public boolean debug = false;
+ /**
+ * Client authentication setting for HTTPS.
+ */
public String clientAuth = "false";
+ /**
+ * Key alias for SSL keystore.
+ */
public String keyAlias = null;
+ /**
+ * HTTP connector protocol.
+ */
public String httpProtocol;
+ /**
+ * Directory name for extracted archive contents.
+ */
public String extractDirectory = ".extract";
+ /**
+ * File reference to the extraction directory.
+ */
public File extractDirectoryFile;
+ /**
+ * Context path for the code source WAR.
+ */
public String codeSourceContextPath = null;
+ /**
+ * WAR file from which the code was loaded.
+ */
public File codeSourceWar = null;
+ /**
+ * Logger name.
+ */
public String loggerName;
Catalina container;
@@ -125,10 +189,17 @@ public class TomcatRunner {
*/
Map<String, String> webappWarPerContext = new HashMap<>();
+ /**
+ * Creates an instance of TomcatRunner.
+ */
public TomcatRunner() {
// no op
}
+ /**
+ * Starts the embedded Tomcat server and waits indefinitely.
+ * @throws Exception if the server fails to start
+ */
public void run() throws Exception {
PasswordUtil.deobfuscateSystemProps();
@@ -350,8 +421,14 @@ public class TomcatRunner {
}
+ /**
+ * Shutdown hook that stops the embedded Tomcat server on JVM exit.
+ */
protected class TomcatShutdownHook extends Thread {
+ /**
+ * Creates an instance of TomcatShutdownHook.
+ */
protected TomcatShutdownHook() {
// no op
}
@@ -420,6 +497,10 @@ public class TomcatRunner {
}
}
+ /**
+ * Stops the embedded Tomcat server.
+ * @throws Exception if the server fails to stop
+ */
public void stop() throws Exception {
if (container != null) {
container.stop();
@@ -429,6 +510,10 @@ public class TomcatRunner {
}
}
+ /**
+ * Extracts archive contents to the extraction directory.
+ * @throws Exception if extraction fails
+ */
protected void extract() throws Exception {
if (extractDirectoryFile.exists()) {
@@ -578,11 +663,19 @@ public class TomcatRunner {
// Ignore
}
+ /**
+ * Returns whether the server.xml configuration should be used.
+ * @return true if server.xml should be used
+ */
public boolean useServerXml() {
return
Boolean.parseBoolean(runtimeProperties.getProperty(USE_SERVER_XML_KEY,
Boolean.FALSE.toString()));
}
+ /**
+ * Prints a debug message if debug mode is enabled.
+ * @param message the message to print
+ */
public void debugMessage(String message) {
if (debug) {
System.out.println(message);
@@ -590,6 +683,10 @@ public class TomcatRunner {
}
+ /**
+ * Returns whether naming support is enabled.
+ * @return true if naming support is enabled
+ */
public boolean enableNaming() {
return
Boolean.parseBoolean(runtimeProperties.getProperty(ENABLE_NAMING_KEY,
Boolean.FALSE.toString()));
}
diff --git a/src/main/java/org/apache/tomcat/maven/runner/TomcatRunnerCli.java
b/src/main/java/org/apache/tomcat/maven/runner/TomcatRunnerCli.java
index 2074b29..f701055 100644
--- a/src/main/java/org/apache/tomcat/maven/runner/TomcatRunnerCli.java
+++ b/src/main/java/org/apache/tomcat/maven/runner/TomcatRunnerCli.java
@@ -32,12 +32,23 @@ import java.util.Map;
import java.util.Properties;
/**
+ * Command-line interface for running standalone Tomcat executable WARs.
+ * Parses command-line options and configures the embedded Tomcat runner.
+ *
* @author Olivier Lamy
- *
* @since 2.0
*/
public class TomcatRunnerCli {
+ /**
+ * Creates an instance of TomcatRunnerCli.
+ */
+ public TomcatRunnerCli() {
+ // default constructor
+ }
+ /**
+ * Filename of the standalone properties file embedded in the archive.
+ */
public static final String STAND_ALONE_PROPERTIES_FILENAME =
"tomcat.standalone.properties";
static final Option HTTP_PORT =
Option.builder().longOpt("httpPort").hasArg().argName("httpPort")
@@ -93,6 +104,11 @@ public class TomcatRunnerCli {
}
+ /**
+ * Main entry point for running standalone Tomcat executable WARs.
+ * @param args command-line arguments
+ * @throws Exception if an error occurs
+ */
public static void main(String[] args) throws Exception {
CommandLineParser parser = new DefaultParser();
CommandLine line = null;
@@ -193,6 +209,10 @@ public class TomcatRunnerCli {
return properties;
}
+ /**
+ * Returns the command-line usage syntax string.
+ * @return the command-line syntax
+ */
public static String getCmdLineSyntax() {
return "java -jar [path to your exec war jar]";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]