Class JettyRunMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.jetty.maven.plugin.AbstractJettyMojo
-
- org.eclipse.jetty.maven.plugin.JettyRunMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
JettyEffectiveWebXml,JettyRunDistro,JettyRunForkedMojo,JettyStartMojo
@Mojo(name="run", requiresDependencyResolution=TEST) @Execute(phase=TEST_COMPILE) public class JettyRunMojo extends AbstractJettyMojoThis goal is used in-situ on a Maven project without first requiring that the project is assembled into a war, saving time during the development cycle.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
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FileclassesDirectoryThe directory containing generated classes.static java.lang.StringDEFAULT_WEBAPP_SRCstatic java.lang.StringFAKE_WEBAPPprotected ResourceoriginalBaseResourceprotected ScanPatternscanClassesPatternAn optional pattern for includes/excludes of classes in the classesDirectoryprotected ScanTargetPattern[]scanTargetPatternsList of directories with ant-style <include> and <exclude> patterns for extra targets to periodically scan for changes.protected java.io.File[]scanTargetsList of files or directories to additionally periodically scan for changes.protected ScanPatternscanTestClassesPatternAn optional pattern for includes/excludes of classes in the testClassesDirectoryprotected java.io.FiletestClassesDirectoryThe directory containing generated test classes.protected booleanuseTestScopeIf 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>warArtifactsList of deps that are warsprotected WarPluginInfowarPluginInfomaven-war-plugin referenceprotected java.io.FilewebAppSourceDirectoryRoot directory for all html/jsp etc filesprotected java.lang.StringwebXmlThe default location of the web.xml file.-
Fields inherited from class org.eclipse.jetty.maven.plugin.AbstractJettyMojo
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 Summary
Constructors Constructor Description JettyRunMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckPomConfiguration()Verify the configuration given in the pom.voidconfigureScanner()voidconfigureWebApplication()Subclasses should invoke this to setup basic info on the webappvoidexecute()static java.lang.StringfileSeparators(java.lang.String path)voidfinishConfigurationBeforeStart()voidgatherScannables()protected org.apache.maven.artifact.ArtifactgetArtifactForOverlay(OverlayConfig o, java.util.List<org.apache.maven.artifact.Artifact> warArtifacts)protected java.lang.StringgetJavaBin()voidrestartWebApp(boolean reconfigureScanner)ResourceunpackOverlay(Overlay overlay)voidunpackOverlays(java.util.List<Overlay> overlays)-
Methods inherited from class org.eclipse.jetty.maven.plugin.AbstractJettyMojo
applyJettyXml, checkPackagingConfiguration, configureMonitor, configurePluginClasspath, findJettyWebXmlFile, getJettyXmlFiles, getSkipMessage, isConfigurationSupported, isExcluded, isPluginArtifact, isScanningEnabled, printSystemProperties, setSystemProperties, setSystemPropertiesFile, startConsoleScanner, startJetty, startScanner, stopScanner
-
-
-
-
Field Detail
-
DEFAULT_WEBAPP_SRC
public static final java.lang.String DEFAULT_WEBAPP_SRC
-
FAKE_WEBAPP
public static final java.lang.String FAKE_WEBAPP
- See Also:
- Constant Field Values
-
useTestScope
@Parameter(alias="useTestClasspath", defaultValue="false") protected boolean useTestScopeIf true, the <testOutputDirectory> and the dependencies of <scope>test<scope> will be put first on the runtime classpath.
-
webXml
@Parameter(defaultValue="${maven.war.webxml}", readonly=true) protected java.lang.String webXmlThe default location of the web.xml file. Will be used if <webApp><descriptor> is not set.
-
classesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true) protected java.io.File classesDirectoryThe directory containing generated classes.
-
scanClassesPattern
@Parameter protected ScanPattern scanClassesPattern
An optional pattern for includes/excludes of classes in the classesDirectory
-
testClassesDirectory
@Parameter(defaultValue="${project.build.testOutputDirectory}", required=true) protected java.io.File testClassesDirectoryThe directory containing generated test classes.
-
scanTestClassesPattern
@Parameter protected ScanPattern scanTestClassesPattern
An optional pattern for includes/excludes of classes in the testClassesDirectory
-
webAppSourceDirectory
@Parameter(defaultValue="${maven.war.src}") protected java.io.File webAppSourceDirectoryRoot directory for all html/jsp etc files
-
scanTargets
@Parameter protected java.io.File[] scanTargets
List of files or directories to additionally periodically scan for changes. Optional.
-
scanTargetPatterns
@Parameter protected ScanTargetPattern[] scanTargetPatterns
List of directories with ant-style <include> and <exclude> patterns for extra targets to periodically scan for changes. Can be used instead of, or in conjunction with <scanTargets>.Optional.
-
warPluginInfo
protected WarPluginInfo warPluginInfo
maven-war-plugin reference
-
warArtifacts
protected java.util.List<org.apache.maven.artifact.Artifact> warArtifacts
List of deps that are wars
-
originalBaseResource
protected Resource originalBaseResource
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Overrides:
executein classAbstractJettyMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException- See Also:
Mojo.execute()
-
checkPomConfiguration
public boolean checkPomConfiguration() throws org.apache.maven.plugin.MojoExecutionExceptionVerify the configuration given in the pom.- Overrides:
checkPomConfigurationin classAbstractJettyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
finishConfigurationBeforeStart
public void finishConfigurationBeforeStart() throws java.lang.Exception- Overrides:
finishConfigurationBeforeStartin classAbstractJettyMojo- Throws:
java.lang.Exception
-
configureWebApplication
public void configureWebApplication() throws java.lang.ExceptionDescription copied from class:AbstractJettyMojoSubclasses should invoke this to setup basic info on the webapp- Overrides:
configureWebApplicationin classAbstractJettyMojo- Throws:
java.lang.Exception- if unable to configure web application
-
configureScanner
public void configureScanner() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
configureScannerin classAbstractJettyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
gatherScannables
public void gatherScannables() throws java.lang.Exception- Throws:
java.lang.Exception
-
restartWebApp
public void restartWebApp(boolean reconfigureScanner) throws java.lang.Exception- Specified by:
restartWebAppin classAbstractJettyMojo- Throws:
java.lang.Exception
-
unpackOverlays
public void unpackOverlays(java.util.List<Overlay> overlays) throws java.lang.Exception
- Throws:
java.lang.Exception
-
unpackOverlay
public Resource unpackOverlay(Overlay overlay) throws java.io.IOException
- Throws:
java.io.IOException
-
getArtifactForOverlay
protected org.apache.maven.artifact.Artifact getArtifactForOverlay(OverlayConfig o, java.util.List<org.apache.maven.artifact.Artifact> warArtifacts)
-
getJavaBin
protected java.lang.String getJavaBin()
-
fileSeparators
public static java.lang.String fileSeparators(java.lang.String path)
-
-