Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Greg Wilkins 2013-11-21 18:45:25 +11:00
commit 3499c52019
2 changed files with 40 additions and 20 deletions

View File

@ -45,6 +45,8 @@ import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
/**
@ -175,6 +177,13 @@ public class JettyRunForkedMojo extends AbstractMojo
*/
private File webAppSourceDirectory;
/**
* Resource Bases
*
* @parameter
*
*/
private String[] resourceBases;
/**
* If true, the webAppSourceDirectory will be first on the list of
@ -436,20 +445,30 @@ public class JettyRunForkedMojo extends AbstractMojo
props.put("tmp.dir.persist", Boolean.toString(persistTempDirectory));
//sort out base dir of webapp
if (webAppSourceDirectory == null || !webAppSourceDirectory.exists())
if (resourceBases == null)
{
webAppSourceDirectory = new File (project.getBasedir(), DEFAULT_WEBAPP_SRC);
if (!webAppSourceDirectory.exists())
//sort out base dir of webapp
if (webAppSourceDirectory == null || !webAppSourceDirectory.exists())
{
//try last resort of making a fake empty dir
File target = new File(project.getBuild().getDirectory());
webAppSourceDirectory = new File(target, FAKE_WEBAPP);
webAppSourceDirectory = new File (project.getBasedir(), DEFAULT_WEBAPP_SRC);
if (!webAppSourceDirectory.exists())
webAppSourceDirectory.mkdirs();
{
//try last resort of making a fake empty dir
File target = new File(project.getBuild().getDirectory());
webAppSourceDirectory = new File(target, FAKE_WEBAPP);
if (!webAppSourceDirectory.exists())
webAppSourceDirectory.mkdirs();
}
}
resourceBases = new String[] { webAppSourceDirectory.getAbsolutePath() };
}
props.put("base.dir", webAppSourceDirectory.getAbsolutePath());
StringBuffer rb = new StringBuffer(resourceBases[0]);
for (int i=1; i<resourceBases.length; i++)
{
rb.append(File.pathSeparator);
rb.append(resourceBases[i]);
}
props.put("base.dirs", rb.toString());
//sort out the resource base directories of the webapp
StringBuilder builder = new StringBuilder();
@ -585,7 +604,7 @@ public class JettyRunForkedMojo extends AbstractMojo
for ( Iterator<Artifact> iter = project.getArtifacts().iterator(); iter.hasNext(); )
{
Artifact artifact = (Artifact) iter.next();
// Test never appears here !
if (((!Artifact.SCOPE_PROVIDED.equals(artifact.getScope())) && (!Artifact.SCOPE_TEST.equals( artifact.getScope())))
||
(useTestScope && Artifact.SCOPE_TEST.equals( artifact.getScope())))

View File

@ -38,6 +38,7 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
import org.eclipse.jetty.xml.XmlConfiguration;
@ -211,12 +212,12 @@ public class Starter
if (str != null)
webApp.setPersistTempDirectory(Boolean.valueOf(str));
// - the base directory
str = (String)props.getProperty("base.dir");
// - the base directories
str = (String)props.getProperty("base.dirs");
if (str != null && !"".equals(str.trim()))
{
webApp.setWar(str);
webApp.setBaseResource(Resource.newResource(str));
webApp.setBaseResource(new ResourceCollection(str.split(File.pathSeparator)));
}
// - put virtual webapp base resource first on resource path or not