@Mojo(name="run", requiresDependencyResolution=TEST) @Execute(phase=TEST_COMPILE) public class JettyRunMojo extends AbstractJettyMojo
The plugin forks a parallel lifecycle to ensure that the "compile" phase has been completed before invoking Jetty. This means that you do not need to explicitly execute a "mvn compile" first. It also means that a "mvn clean jetty:run" will ensure that a full fresh compile is done before invoking Jetty.
Once invoked, the plugin can be configured to run continuously, scanning for changes in the project and automatically performing a hot redeploy when necessary. This allows the developer to concentrate on coding changes to the project using their IDE of choice and have those changes immediately and transparently reflected in the running web container, eliminating development time that is wasted on rebuilding, reassembling and redeploying.
You may also specify the location of a jetty.xml file whose contents will be applied before any plugin configuration. This can be used, for example, to deploy a static webapp that is not part of your maven build.
There is a reference guide to the configuration parameters for this plugin. Runs jetty directly from a maven project
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
classesDirectory
The directory containing generated classes.
|
static java.lang.String |
DEFAULT_WEBAPP_SRC |
static java.lang.String |
FAKE_WEBAPP |
protected Resource |
originalBaseResource |
protected ScanPattern |
scanClassesPattern
An optional pattern for includes/excludes of classes in the classesDirectory
|
protected ScanTargetPattern[] |
scanTargetPatterns
List of directories with ant-style <include> and <exclude> patterns
for extra targets to periodically scan for changes.
|
protected java.io.File[] |
scanTargets
List of files or directories to additionally periodically scan for changes.
|
protected ScanPattern |
scanTestClassesPattern
An optional pattern for includes/excludes of classes in the testClassesDirectory
|
protected java.io.File |
testClassesDirectory
The directory containing generated test classes.
|
protected boolean |
useTestScope
If true, the <testOutputDirectory>
and the dependencies of <scope>test<scope>
will be put first on the runtime classpath.
|
protected java.util.List<org.apache.maven.artifact.Artifact> |
warArtifacts
List of deps that are wars
|
protected WarPluginInfo |
warPluginInfo
maven-war-plugin reference
|
protected java.io.File |
webAppSourceDirectory
Root directory for all html/jsp etc files
|
protected java.lang.String |
webXml
The default location of the web.xml file.
|
consoleScanner, contextHandlers, contextXml, dumpOnStart, excludedGoals, execution, httpConnector, jettyXml, loginServices, nonBlocking, pluginArtifacts, project, projectArtifacts, reload, requestLog, scanIntervalSeconds, scanner, server, serverSupport, skip, stopKey, stopPort, supportedPackagings, systemProperties, systemPropertiesFile, useProvidedScope, webApp
Constructor and Description |
---|
JettyRunMojo() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkPomConfiguration()
Verify the configuration given in the pom.
|
void |
configureScanner() |
void |
configureWebApplication()
Subclasses should invoke this to setup basic info
on the webapp
|
void |
execute() |
static java.lang.String |
fileSeparators(java.lang.String path) |
void |
finishConfigurationBeforeStart() |
void |
gatherScannables() |
protected org.apache.maven.artifact.Artifact |
getArtifactForOverlay(OverlayConfig o,
java.util.List<org.apache.maven.artifact.Artifact> warArtifacts) |
protected java.lang.String |
getJavaBin() |
protected org.apache.maven.project.MavenProject |
getProjectReference(org.apache.maven.artifact.Artifact artifact,
org.apache.maven.project.MavenProject project) |
void |
restartWebApp(boolean reconfigureScanner) |
Resource |
unpackOverlay(Overlay overlay) |
void |
unpackOverlays(java.util.List<Overlay> overlays) |
applyJettyXml, checkPackagingConfiguration, configureMonitor, configurePluginClasspath, findJettyWebXmlFile, getJettyXmlFiles, getSkipMessage, isConfigurationSupported, isExcluded, isPluginArtifact, isScanningEnabled, printSystemProperties, setSystemProperties, setSystemPropertiesFile, startConsoleScanner, startJetty, startScanner, stopScanner
public static final java.lang.String DEFAULT_WEBAPP_SRC
public static final java.lang.String FAKE_WEBAPP
@Parameter(alias="useTestClasspath", defaultValue="false") protected boolean useTestScope
@Parameter(defaultValue="${maven.war.webxml}", readonly=true) protected java.lang.String webXml
@Parameter(defaultValue="${project.build.outputDirectory}", required=true) protected java.io.File classesDirectory
@Parameter protected ScanPattern scanClassesPattern
@Parameter(defaultValue="${project.build.testOutputDirectory}", required=true) protected java.io.File testClassesDirectory
@Parameter protected ScanPattern scanTestClassesPattern
@Parameter(defaultValue="${maven.war.src}") protected java.io.File webAppSourceDirectory
@Parameter protected java.io.File[] scanTargets
@Parameter protected ScanTargetPattern[] scanTargetPatterns
protected WarPluginInfo warPluginInfo
protected java.util.List<org.apache.maven.artifact.Artifact> warArtifacts
protected Resource originalBaseResource
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
execute
in interface org.apache.maven.plugin.Mojo
execute
in class AbstractJettyMojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
AbstractJettyMojo.execute()
public boolean checkPomConfiguration() throws org.apache.maven.plugin.MojoExecutionException
checkPomConfiguration
in class AbstractJettyMojo
org.apache.maven.plugin.MojoExecutionException
AbstractJettyMojo.checkPomConfiguration()
public void finishConfigurationBeforeStart() throws java.lang.Exception
finishConfigurationBeforeStart
in class AbstractJettyMojo
java.lang.Exception
public void configureWebApplication() throws java.lang.Exception
AbstractJettyMojo
configureWebApplication
in class AbstractJettyMojo
java.lang.Exception
- if unable to configure web applicationAbstractJettyMojo.configureWebApplication()
public void configureScanner() throws org.apache.maven.plugin.MojoExecutionException
configureScanner
in class AbstractJettyMojo
org.apache.maven.plugin.MojoExecutionException
AbstractJettyMojo.configureScanner()
public void gatherScannables() throws java.lang.Exception
java.lang.Exception
public void restartWebApp(boolean reconfigureScanner) throws java.lang.Exception
restartWebApp
in class AbstractJettyMojo
java.lang.Exception
AbstractJettyMojo.restartWebApp(boolean)
protected org.apache.maven.project.MavenProject getProjectReference(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.MavenProject project)
public void unpackOverlays(java.util.List<Overlay> overlays) throws java.lang.Exception
java.lang.Exception
public Resource unpackOverlay(Overlay overlay) throws java.io.IOException
java.io.IOException
protected org.apache.maven.artifact.Artifact getArtifactForOverlay(OverlayConfig o, java.util.List<org.apache.maven.artifact.Artifact> warArtifacts)
protected java.lang.String getJavaBin()
public static java.lang.String fileSeparators(java.lang.String path)
Copyright © 1995–2023 Webtide. All rights reserved.