@Mojo(name="run-distro", requiresDependencyResolution=TEST) @Execute(phase=TEST_COMPILE) public class JettyRunDistro extends JettyRunMojo
Modifier and Type | Field and Description |
---|---|
private org.apache.maven.shared.artifact.resolve.ArtifactResolver |
artifactResolver |
private java.util.Map<java.lang.String,java.lang.String> |
env
Extra environment variables to be passed to the forked process
|
private java.lang.String |
javaPath |
static java.lang.String |
JETTY_HOME_ARTIFACTID |
static java.lang.String |
JETTY_HOME_GROUPID |
private java.io.File |
jettyBase
Optional jetty.base dir
|
private java.io.File |
jettyHome
Optional jetty.home dir
|
private java.lang.String[] |
jettyProperties
Optional list of jetty properties to put on the command line
|
private java.lang.String |
jvmArgs
Arbitrary jvm args to pass to the forked process
|
private java.util.List<org.apache.maven.model.Dependency> |
libExtJars |
private long |
maxChildCheckInterval
Millisecs to wait between each
check to see if the child started successfully.
|
private int |
maxChildChecks
Max number of times to try checking if the
child has started successfully.
|
private java.lang.String[] |
modules
Optional list of other modules to
activate.
|
protected org.apache.maven.plugin.descriptor.PluginDescriptor |
plugin
This plugin
|
private java.lang.String |
pluginVersion |
private java.util.Random |
random |
private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> |
remoteRepositories
The project's remote repositories to use for the resolution.
|
private org.apache.maven.execution.MavenSession |
session |
protected java.io.File |
target
The target directory
|
private java.io.File |
targetBase |
private java.nio.file.Path |
tokenFile |
private boolean |
waitForChild
Whether to wait for the child to finish or not.
|
classesDirectory, DEFAULT_WEBAPP_SRC, FAKE_WEBAPP, originalBaseResource, scanClassesPattern, scanTargetPatterns, scanTargets, scanTestClassesPattern, testClassesDirectory, useTestScope, warArtifacts, warPluginInfo, webAppSourceDirectory, webXml
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 |
---|
JettyRunDistro() |
Modifier and Type | Method and 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 properties
|
private java.lang.String |
createToken() |
void |
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() |
checkPomConfiguration, configureWebApplication, fileSeparators, finishConfigurationBeforeStart, gatherScannables, getArtifactForOverlay, getJavaBin, unpackOverlay, unpackOverlays
applyJettyXml, checkPackagingConfiguration, configureMonitor, configurePluginClasspath, findJettyWebXmlFile, getJettyXmlFiles, getSkipMessage, isConfigurationSupported, isExcluded, isPluginArtifact, isScanningEnabled, printSystemProperties, setSystemProperties, setSystemPropertiesFile, startConsoleScanner
public static final java.lang.String JETTY_HOME_GROUPID
public static final java.lang.String JETTY_HOME_ARTIFACTID
@Parameter(defaultValue="${plugin}", required=true, readonly=true) protected org.apache.maven.plugin.descriptor.PluginDescriptor plugin
@Parameter(defaultValue="${project.build.directory}", readonly=true, required=true) protected java.io.File target
@Parameter private java.io.File jettyHome
@Parameter private java.io.File jettyBase
@Parameter private java.lang.String[] modules
@Parameter(property="jetty.jvmArgs") private java.lang.String jvmArgs
@Parameter private java.util.Map<java.lang.String,java.lang.String> env
@Parameter private java.lang.String[] jettyProperties
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${project.remoteArtifactRepositories}", required=true, readonly=true) private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
@Component private org.apache.maven.shared.artifact.resolve.ArtifactResolver artifactResolver
@Parameter(defaultValue="${plugin.version}", readonly=true) private java.lang.String pluginVersion
@Parameter(defaultValue="true") private boolean waitForChild
@Parameter(defaultValue="10") private int maxChildChecks
@Parameter(defaultValue="100") private long maxChildCheckInterval
private java.io.File targetBase
private java.util.List<org.apache.maven.model.Dependency> libExtJars
private java.util.Random random
private java.nio.file.Path tokenFile
@Parameter(property="jetty.javaPath") private java.lang.String javaPath
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 JettyRunMojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
JettyRunMojo.execute()
public void startJetty() throws org.apache.maven.plugin.MojoExecutionException
startJetty
in class AbstractJettyMojo
org.apache.maven.plugin.MojoExecutionException
AbstractJettyMojo.startJetty()
public void configureJettyHome() throws java.lang.Exception
java.lang.Exception
- if jetty distribution cannot be found neither downloadedpublic 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.artifact.resolve.ArtifactResolverException
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"org.apache.maven.shared.artifact.resolve.ArtifactResolverException
- in case of an error while resolving the artifactpublic void configureJettyBase() throws java.lang.Exception
java.lang.Exception
- if any error occurred while copying filespublic void createPropertiesFile(java.io.File file) throws java.lang.Exception
file
- the file to place the properties intojava.lang.Exception
- if any I/O exception during generating the properties filepublic java.lang.ProcessBuilder configureCommand()
public void startScanner() throws java.lang.Exception
AbstractJettyMojo
startScanner
in class AbstractJettyMojo
java.lang.Exception
- if unable to start scannerAbstractJettyMojo.startScanner()
public void stopScanner() throws java.lang.Exception
stopScanner
in class AbstractJettyMojo
java.lang.Exception
AbstractJettyMojo.stopScanner()
public void restartWebApp(boolean reconfigureScanner) throws java.lang.Exception
restartWebApp
in class JettyRunMojo
java.lang.Exception
AbstractJettyMojo.restartWebApp(boolean)
public void configureScanner() throws org.apache.maven.plugin.MojoExecutionException
configureScanner
in class JettyRunMojo
org.apache.maven.plugin.MojoExecutionException
AbstractJettyMojo.configureScanner()
private java.lang.String createToken()