fix fragment from dependent projects #1623

Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
olivier lamy 2017-06-23 21:32:11 +10:00
parent 4d43261031
commit 008158d975
4 changed files with 24 additions and 5 deletions

View File

@ -291,7 +291,11 @@ public class JettyRunMojo extends AbstractJettyMojo
.collect( Collectors.toList() );
webApp.getMetaData().getContainerResources().addAll( dependencyResources );
webApp.setWebInfLib (getDependencyFiles());
// webApp.getWebInfLib().addAll( dependencyResources //
// .stream() //
// .map( resource -> toFile(resource) ) //
// .collect( Collectors.toList() ) );
webApp.getDependentProjects().addAll( dependencyResources );
//get copy of a list of war artifacts
Set<Artifact> matchedWarArtifacts = new HashSet<Artifact>();
@ -373,7 +377,17 @@ public class JettyRunMojo extends AbstractJettyMojo
getLog().info("Webapp directory = " + webAppSourceDirectory.getCanonicalPath());
}
private static File toFile(Resource resource)
{
try
{
return resource.getFile();
}
catch ( IOException e )
{
throw new RuntimeException( e.getMessage(), e );
}
}
/**

View File

@ -104,9 +104,7 @@ public class JettyWebAppContext extends WebAppContext
private Resource _quickStartWebXml;
private String _originAttribute;
private boolean _generateOrigin;
private List<Resource> dependentProjects = new ArrayList<>();
/**
* Set the "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern" with a pattern for matching jars on
@ -322,6 +320,11 @@ public class JettyWebAppContext extends WebAppContext
return _webInfJars;
}
public List<Resource> getDependentProjects()
{
return dependentProjects;
}
/* ------------------------------------------------------------ */
public void setGenerateQuickStart (boolean quickStart)
{

View File

@ -93,6 +93,8 @@ public class MavenWebInfConfiguration extends WebInfConfiguration
public void preConfigure(WebAppContext context) throws Exception
{
super.preConfigure(context);
((JettyWebAppContext)context).getDependentProjects()
.stream().forEach( resource -> context.getMetaData().addWebInfJar( resource ) );
}