Package org.eclipse.jetty.maven.plugin
Class JettyRunDistro
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.jetty.maven.plugin.AbstractJettyMojo
-
- org.eclipse.jetty.maven.plugin.JettyRunMojo
-
- org.eclipse.jetty.maven.plugin.JettyRunDistro
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="run-distro", requiresDependencyResolution=TEST) @Execute(phase=TEST_COMPILE) public class JettyRunDistro extends JettyRunMojo
This goal is used to deploy the unassembled webapp into a jetty distribution. If the location of an existing unpacked distribution is not supplied as the configuration param jettyHome, this goal will download and unpack the jetty distro matching the version of this plugin before deploying the webapp. The webapp will execute in the distro in a forked process. The stopKey, stopPort configuration elements can be used to control the stopping of the forked process. By default, this plugin will launch the forked jetty instance and wait for it to complete (in which case it acts much like the jetty:run goal, and you will need to Cntrl-C to stop). By setting the configuration element waitForChild to false, the plugin will terminate after having forked the jetty process. In this case you can use the jetty:stop goal to terminate the process. This goal does NOT support the scanIntervalSeconds parameter: the webapp will be deployed only once. See https://jetty.org/docs/ for more information on this and other jetty plugins. Runs unassembled webapp in a locally installed jetty distro
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JETTY_HOME_ARTIFACTID
static java.lang.String
JETTY_HOME_GROUPID
protected org.apache.maven.plugin.descriptor.PluginDescriptor
plugin
This pluginprotected java.io.File
target
The target directory-
Fields inherited from class org.eclipse.jetty.maven.plugin.JettyRunMojo
classesDirectory, DEFAULT_WEBAPP_SRC, FAKE_WEBAPP, originalBaseResource, scanClassesPattern, scanTargetPatterns, scanTargets, scanTestClassesPattern, testClassesDirectory, useTestScope, warArtifacts, warPluginInfo, webAppSourceDirectory, webXml
-
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 JettyRunDistro()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ProcessBuilder
configureCommand()
Make the command to spawn a process to run jetty from a distro.void
configureJettyBase()
Create or configure a jetty base.void
configureJettyHome()
If jetty home does not exist, download it and unpack to build dir.void
configureScanner()
void
createPropertiesFile(java.io.File file)
Convert webapp config to propertiesvoid
execute()
org.apache.maven.artifact.Artifact
resolveArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String extension)
Resolve an Artifact from remote repo if necessary.void
restartWebApp(boolean reconfigureScanner)
void
startJetty()
void
startScanner()
Run a scanner thread on the given list of files and directories, calling stop/start on the given list of LifeCycle objects if any of the watched files change.void
stopScanner()
-
Methods inherited from class org.eclipse.jetty.maven.plugin.JettyRunMojo
checkPomConfiguration, configureWebApplication, fileSeparators, finishConfigurationBeforeStart, gatherScannables, getArtifactForOverlay, getJavaBin, unpackOverlay, unpackOverlays
-
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
-
-
-
-
Field Detail
-
JETTY_HOME_GROUPID
public static final java.lang.String JETTY_HOME_GROUPID
- See Also:
- Constant Field Values
-
JETTY_HOME_ARTIFACTID
public static final java.lang.String JETTY_HOME_ARTIFACTID
- See Also:
- Constant Field Values
-
plugin
@Parameter(defaultValue="${plugin}", required=true, readonly=true) protected org.apache.maven.plugin.descriptor.PluginDescriptor plugin
This plugin
-
target
@Parameter(defaultValue="${project.build.directory}", readonly=true, required=true) protected java.io.File target
The target directory
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Overrides:
execute
in classJettyRunMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
- See Also:
JettyRunMojo.execute()
-
startJetty
public void startJetty() throws org.apache.maven.plugin.MojoExecutionException
- Overrides:
startJetty
in classAbstractJettyMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
- See Also:
AbstractJettyMojo.startJetty()
-
configureJettyHome
public void configureJettyHome() throws java.lang.Exception
If jetty home does not exist, download it and unpack to build dir.- Throws:
java.lang.Exception
- if jetty distribution cannot be found neither downloaded
-
resolveArtifact
public org.apache.maven.artifact.Artifact resolveArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String extension) throws org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException
Resolve an Artifact from remote repo if necessary.- Parameters:
groupId
- the groupid of the artifactartifactId
- the artifactId of the artifactversion
- the version of the artifactextension
- the extension type of the artifact eg "zip", "jar"- Returns:
- the artifact from the local or remote repo
- Throws:
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException
- in case of an error while resolving the artifact
-
configureJettyBase
public void configureJettyBase() throws java.lang.Exception
Create or configure a jetty base.- Throws:
java.lang.Exception
- if any error occurred while copying files
-
createPropertiesFile
public void createPropertiesFile(java.io.File file) throws java.lang.Exception
Convert webapp config to properties- Parameters:
file
- the file to place the properties into- Throws:
java.lang.Exception
- if any I/O exception during generating the properties file
-
configureCommand
public java.lang.ProcessBuilder configureCommand()
Make the command to spawn a process to run jetty from a distro.- Returns:
- the command configured
-
startScanner
public void startScanner() throws java.lang.Exception
Description copied from class:AbstractJettyMojo
Run a scanner thread on the given list of files and directories, calling stop/start on the given list of LifeCycle objects if any of the watched files change.- Overrides:
startScanner
in classAbstractJettyMojo
- Throws:
java.lang.Exception
- if unable to start scanner- See Also:
AbstractJettyMojo.startScanner()
-
stopScanner
public void stopScanner() throws java.lang.Exception
- Overrides:
stopScanner
in classAbstractJettyMojo
- Throws:
java.lang.Exception
- See Also:
AbstractJettyMojo.stopScanner()
-
restartWebApp
public void restartWebApp(boolean reconfigureScanner) throws java.lang.Exception
- Overrides:
restartWebApp
in classJettyRunMojo
- Throws:
java.lang.Exception
- See Also:
AbstractJettyMojo.restartWebApp(boolean)
-
configureScanner
public void configureScanner() throws org.apache.maven.plugin.MojoExecutionException
- Overrides:
configureScanner
in classJettyRunMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
- See Also:
AbstractJettyMojo.configureScanner()
-
-