parent
1de8a8799a
commit
e9847f6a1a
|
@ -377,8 +377,6 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
|
||||
/**
|
||||
* This plugin
|
||||
*
|
||||
* @required
|
||||
*/
|
||||
@Parameter (defaultValue = "${plugin}", readonly = true, required = true)
|
||||
protected PluginDescriptor plugin;
|
||||
|
@ -597,6 +595,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
|
||||
/**
|
||||
* Verify some basic configuration is present, supplying defaults if not.
|
||||
* @throws MojoExecutionException
|
||||
*/
|
||||
protected void verifyPomConfiguration() throws MojoExecutionException
|
||||
{
|
||||
|
@ -648,6 +647,10 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
|
||||
/**
|
||||
* Unite system properties set via systemPropertiesFile element and the systemProperties element.
|
||||
* Properties from the pom override properties from the file.
|
||||
*
|
||||
* @return united properties map
|
||||
* @throws MojoExecutionException
|
||||
*/
|
||||
protected Map<String,String> mergeSystemProperties()
|
||||
throws MojoExecutionException
|
||||
|
@ -726,7 +729,9 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
* Get any dependencies that are scope "provided" if useProvidedScope == true. Ensure
|
||||
* that only those dependencies that are not already present via the plugin are
|
||||
* included.
|
||||
*
|
||||
* @return provided scope dependencies that are not also plugin dependencies.
|
||||
* @throws MojoExecutionException
|
||||
*/
|
||||
protected List<File> getProvidedJars() throws MojoExecutionException
|
||||
{
|
||||
|
@ -962,10 +967,10 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
getLog().info("Web overrides = " + (webApp.getOverrideDescriptor() == null ? " none" : webApp.getOverrideDescriptor()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Try and find a jetty-web.xml file, using some
|
||||
* historical naming conventions if necessary.
|
||||
*
|
||||
* @param webInfDir the web inf directory
|
||||
* @return the jetty web xml file
|
||||
*/
|
||||
|
@ -991,8 +996,8 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
/**
|
||||
* Get a file into which to write output from jetty.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
* @param name the name of the file
|
||||
* @return the created file
|
||||
* @throws Exception
|
||||
*/
|
||||
protected File getJettyOutputFile(String name) throws Exception
|
||||
|
@ -1060,6 +1065,14 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the artifact is suitable to be considered part of the
|
||||
* virtual web-inf/lib.
|
||||
*
|
||||
* @param artifact the artifact to check
|
||||
* @return true if the artifact represents a jar, isn't scope provided and
|
||||
* is scope test, if useTestScope is enabled. False otherwise.
|
||||
*/
|
||||
private boolean isArtifactOKForWebInfLib(Artifact artifact)
|
||||
{
|
||||
//The dependency cannot be of type war
|
||||
|
|
|
@ -52,6 +52,10 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
protected PathWatcher scanner;
|
||||
protected File webAppPropsFile;
|
||||
|
||||
/**
|
||||
* @param args arguments that were passed to main
|
||||
* @throws Exception
|
||||
*/
|
||||
public JettyForkedChild(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
|
@ -59,6 +63,12 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
configure(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on the args passed to the program, configure jetty.
|
||||
*
|
||||
* @param args args that were passed to the program.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void configure(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
|
@ -159,6 +169,14 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
jetty.setExitVm(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load properties from a file describing the webapp if one is
|
||||
* present.
|
||||
*
|
||||
* @return file contents as properties
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private Properties loadWebAppProps() throws FileNotFoundException, IOException
|
||||
{
|
||||
Properties props = new Properties();
|
||||
|
@ -167,6 +185,10 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a jetty instance and webapp. This thread will
|
||||
* wait until jetty exits.
|
||||
*/
|
||||
public void doStart()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -189,11 +211,6 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
jetty.join();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
|
@ -203,5 +220,4 @@ public class JettyForkedChild extends AbstractLifeCycle
|
|||
JettyForkedChild child = new JettyForkedChild(args);
|
||||
child.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -304,10 +304,15 @@ public class JettyRunMojo extends AbstractWebAppMojo
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#restartWebApp(boolean)
|
||||
/**
|
||||
* Stop an executing webapp and restart it after optionally
|
||||
* reconfiguring it.
|
||||
*
|
||||
* @param reconfigure if true, the scanner will
|
||||
* be reconfigured after changes to the pom. If false, only
|
||||
* the webapp will be reconfigured.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void restartWebApp(boolean reconfigure) throws Exception
|
||||
{
|
||||
|
|
|
@ -25,6 +25,9 @@ import org.eclipse.jetty.util.resource.Resource;
|
|||
|
||||
/**
|
||||
* Overlay
|
||||
*
|
||||
* An Overlay represents overlay information derived from the
|
||||
* maven-war-plugin.
|
||||
*/
|
||||
public class Overlay
|
||||
{
|
||||
|
@ -76,6 +79,7 @@ public class Overlay
|
|||
* Unpack the overlay into the given directory. Only
|
||||
* unpack if the directory does not exist, or the overlay
|
||||
* has been modified since the dir was created.
|
||||
*
|
||||
* @param dir the directory into which to unpack the overlay
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
|
@ -80,7 +80,7 @@ public class QuickStartGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param server the server to set
|
||||
* @param server the server to use
|
||||
*/
|
||||
public void setServer(Server server)
|
||||
{
|
||||
|
@ -92,6 +92,9 @@ public class QuickStartGenerator
|
|||
return webAppPropsFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param webAppPropsFile properties file describing the webapp
|
||||
*/
|
||||
public void setWebAppPropsFile(File webAppPropsFile)
|
||||
{
|
||||
this.webAppPropsFile = webAppPropsFile;
|
||||
|
@ -102,11 +105,19 @@ public class QuickStartGenerator
|
|||
return contextXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param contextXml a context xml file to apply to the webapp
|
||||
*/
|
||||
public void setContextXml(String contextXml)
|
||||
{
|
||||
this.contextXml = contextXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the webapp in preparation for quickstart generation.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void prepareWebApp()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -125,6 +136,8 @@ public class QuickStartGenerator
|
|||
/**
|
||||
* Run enough of jetty to generate a full quickstart xml file for the
|
||||
* webapp. The tmp directory is persisted.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void generate()
|
||||
throws Exception
|
||||
|
|
|
@ -54,13 +54,14 @@ public class ServerSupport
|
|||
|
||||
/**
|
||||
* Set up the handler structure to receive a webapp.
|
||||
* Also put in a DefaultHandler so we get a nice page
|
||||
* Also put in a DefaultHandler so we get a nicer page
|
||||
* than a 404 if we hit the root and the webapp's
|
||||
* context isn't at root.
|
||||
*
|
||||
* @param server the server
|
||||
* @param requestLog the request log
|
||||
* @throws Exception if unable to configure the handlers
|
||||
*
|
||||
* @param server the server to use
|
||||
* @param contextHandlers the context handlers to include
|
||||
* @param requestLog a request log to use
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void configureHandlers(Server server, List<ContextHandler> contextHandlers, RequestLog requestLog) throws Exception
|
||||
{
|
||||
|
@ -158,6 +159,12 @@ public class ServerSupport
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a WebAppContext to a Server
|
||||
* @param server the server to use
|
||||
* @param webapp the webapp to add
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void addWebApplication(Server server, WebAppContext webapp) throws Exception
|
||||
{
|
||||
if (server == null)
|
||||
|
@ -168,6 +175,12 @@ public class ServerSupport
|
|||
contexts.addHandler(webapp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a ContextHandlerCollection for a Server.
|
||||
*
|
||||
* @param server the Server to check.
|
||||
* @return The ContextHandlerCollection or null if not found.
|
||||
*/
|
||||
public static ContextHandlerCollection findContextHandlerCollection(Server server)
|
||||
{
|
||||
if (server == null)
|
||||
|
|
|
@ -224,6 +224,7 @@ public class WarPluginInfo
|
|||
/**
|
||||
* Check if the given artifact matches the group and artifact coordinates.
|
||||
*
|
||||
* @param a the artifact to check
|
||||
* @param gid the group id
|
||||
* @param aid the artifact id
|
||||
* @return true if matched false otherwise
|
||||
|
@ -239,5 +240,4 @@ public class WarPluginInfo
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue