Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2015-07-08 03:09:41 -0400
committerJan Bartel2015-07-08 03:10:31 -0400
commit77bdf84f5cf0af1ca618f1d22bc7d7b20387f0ae (patch)
tree6045d0f4036fae52f6f10ca0548a2c4fa22a01d9 /jetty-maven-plugin
parent7fbf512b17819c625c9e74aa793813b06a607a8f (diff)
downloadorg.eclipse.jetty.project-77bdf84f5cf0af1ca618f1d22bc7d7b20387f0ae.tar.gz
org.eclipse.jetty.project-77bdf84f5cf0af1ca618f1d22bc7d7b20387f0ae.tar.xz
org.eclipse.jetty.project-77bdf84f5cf0af1ca618f1d22bc7d7b20387f0ae.zip
470505 jetty-maven-plugin JettyWebAppContext#setQuickStartWebDescriptor should accept a Maven-friendly type
Diffstat (limited to 'jetty-maven-plugin')
-rw-r--r--jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java41
-rw-r--r--jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java29
-rw-r--r--jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java8
3 files changed, 46 insertions, 32 deletions
diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java
index 11e0a8aabe..924458e28d 100644
--- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java
+++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java
@@ -73,16 +73,7 @@ public class JettyEffectiveWebXml extends JettyRunMojo
{
//Only do enough setup to be able to produce a quickstart-web.xml file
- //if the user didn't nominate a file to generate into, pick the name and
- //make sure that it is deleted on exit
- if (effectiveWebXml == null)
- {
- deleteOnExit = true;
- effectiveWebXml = new File(target, "effective-web.xml");
- effectiveWebXml.deleteOnExit();
- }
-
- Resource descriptor = Resource.newResource(effectiveWebXml);
+
QueuedThreadPool tpool = null;
@@ -104,13 +95,27 @@ public class JettyEffectiveWebXml extends JettyRunMojo
webApp.setCopyWebDir(false);
webApp.setCopyWebInf(false);
webApp.setGenerateQuickStart(true);
-
- if (!effectiveWebXml.getParentFile().exists())
- effectiveWebXml.getParentFile().mkdirs();
- if (!effectiveWebXml.exists())
- effectiveWebXml.createNewFile();
-
- webApp.setQuickStartWebDescriptor(descriptor);
+
+ //if the user didn't nominate a file to generate into, pick the name and
+ //make sure that it is deleted on exit
+ if (webApp.getQuickStartWebDescriptor() == null)
+ {
+ if (effectiveWebXml == null)
+ {
+ deleteOnExit = true;
+ effectiveWebXml = new File(target, "effective-web.xml");
+ effectiveWebXml.deleteOnExit();
+ }
+
+ Resource descriptor = Resource.newResource(effectiveWebXml);
+
+ if (!effectiveWebXml.getParentFile().exists())
+ effectiveWebXml.getParentFile().mkdirs();
+ if (!effectiveWebXml.exists())
+ effectiveWebXml.createNewFile();
+
+ webApp.setQuickStartWebDescriptor(descriptor);
+ }
ServerSupport.addWebApplication(server, webApp);
@@ -142,7 +147,7 @@ public class JettyEffectiveWebXml extends JettyRunMojo
try
{
//just show the result in the log
- getLog().info(IO.toString(descriptor.getInputStream()));
+ getLog().info(IO.toString(webApp.getQuickStartWebDescriptor().getInputStream()));
}
catch (IOException e)
{
diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java
index d51c44cfb9..d4ac65e2ac 100644
--- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java
+++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java
@@ -233,10 +233,7 @@ public class JettyRunForkedMojo extends JettyRunMojo
{
//Only do enough setup to be able to produce a quickstart-web.xml file to
//pass onto the forked process to run
-
- if (forkWebXml == null)
- forkWebXml = new File (target, "fork-web.xml");
-
+
try
{
printSystemProperties();
@@ -253,21 +250,27 @@ public class JettyRunForkedMojo extends JettyRunMojo
//copy the base resource as configured by the plugin
originalBaseResource = webApp.getBaseResource();
-
+
//get the original persistance setting
originalPersistTemp = webApp.isPersistTempDirectory();
-
+
//set the webapp up to do very little other than generate the quickstart-web.xml
webApp.setCopyWebDir(false);
webApp.setCopyWebInf(false);
webApp.setGenerateQuickStart(true);
-
- if (!forkWebXml.getParentFile().exists())
- forkWebXml.getParentFile().mkdirs();
- if (!forkWebXml.exists())
- forkWebXml.createNewFile();
-
- webApp.setQuickStartWebDescriptor(Resource.newResource(forkWebXml));
+
+ if (webApp.getQuickStartWebDescriptor() == null)
+ {
+ if (forkWebXml == null)
+ forkWebXml = new File (target, "fork-web.xml");
+
+ if (!forkWebXml.getParentFile().exists())
+ forkWebXml.getParentFile().mkdirs();
+ if (!forkWebXml.exists())
+ forkWebXml.createNewFile();
+
+ webApp.setQuickStartWebDescriptor(Resource.newResource(forkWebXml));
+ }
//add webapp to our fake server instance
ServerSupport.addWebApplication(server, webApp);
diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java
index b4b52441df..8f1f343584 100644
--- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java
+++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java
@@ -243,7 +243,13 @@ public class JettyWebAppContext extends WebAppContext
}
/* ------------------------------------------------------------ */
- public void setQuickStartWebDescriptor (Resource quickStartWebXml)
+ public void setQuickStartWebDescriptor (String quickStartWebXml) throws Exception
+ {
+ setQuickStartWebDescriptor(Resource.newResource(quickStartWebXml));
+ }
+
+ /* ------------------------------------------------------------ */
+ protected void setQuickStartWebDescriptor (Resource quickStartWebXml)
{
_quickStartWebXml = quickStartWebXml;
}

Back to the top