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 JettyRunMojoThis 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.StringJETTY_HOME_ARTIFACTIDstatic java.lang.StringJETTY_HOME_GROUPIDprotected org.apache.maven.plugin.descriptor.PluginDescriptorpluginThis pluginprotected java.io.FiletargetThe 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.ProcessBuilderconfigureCommand()Make the command to spawn a process to run jetty from a distro.voidconfigureJettyBase()Create or configure a jetty base.voidconfigureJettyHome()If jetty home does not exist, download it and unpack to build dir.voidconfigureScanner()voidcreatePropertiesFile(java.io.File file)Convert webapp config to propertiesvoidexecute()org.apache.maven.artifact.ArtifactresolveArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String extension)Resolve an Artifact from remote repo if necessary.voidrestartWebApp(boolean reconfigureScanner)voidstartJetty()voidstartScanner()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.voidstopScanner()-
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 pluginThis plugin
-
target
@Parameter(defaultValue="${project.build.directory}", readonly=true, required=true) protected java.io.File targetThe target directory
-
-
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 classJettyRunMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException- See Also:
JettyRunMojo.execute()
-
startJetty
public void startJetty() throws org.apache.maven.plugin.MojoExecutionException- Overrides:
startJettyin classAbstractJettyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- See Also:
AbstractJettyMojo.startJetty()
-
configureJettyHome
public void configureJettyHome() throws java.lang.ExceptionIf 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.ArtifactResolverExceptionResolve 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.ExceptionCreate 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.ExceptionConvert 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.ExceptionDescription copied from class:AbstractJettyMojoRun 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:
startScannerin classAbstractJettyMojo- Throws:
java.lang.Exception- if unable to start scanner- See Also:
AbstractJettyMojo.startScanner()
-
stopScanner
public void stopScanner() throws java.lang.Exception- Overrides:
stopScannerin classAbstractJettyMojo- Throws:
java.lang.Exception- See Also:
AbstractJettyMojo.stopScanner()
-
restartWebApp
public void restartWebApp(boolean reconfigureScanner) throws java.lang.Exception- Overrides:
restartWebAppin classJettyRunMojo- Throws:
java.lang.Exception- See Also:
AbstractJettyMojo.restartWebApp(boolean)
-
configureScanner
public void configureScanner() throws org.apache.maven.plugin.MojoExecutionException- Overrides:
configureScannerin classJettyRunMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- See Also:
AbstractJettyMojo.configureScanner()
-
-