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 committed by Joakim Erdfelt
parent aae7b38b82
commit dfb4e85c0a
4 changed files with 24 additions and 5 deletions

View File

@ -291,7 +291,11 @@ public class JettyRunMojo extends AbstractJettyMojo
.collect( Collectors.toList() ); .collect( Collectors.toList() );
webApp.getMetaData().getContainerResources().addAll( dependencyResources ); webApp.getMetaData().getContainerResources().addAll( dependencyResources );
webApp.setWebInfLib (getDependencyFiles()); 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 //get copy of a list of war artifacts
Set<Artifact> matchedWarArtifacts = new HashSet<Artifact>(); Set<Artifact> matchedWarArtifacts = new HashSet<Artifact>();
@ -373,7 +377,17 @@ public class JettyRunMojo extends AbstractJettyMojo
getLog().info("Webapp directory = " + webAppSourceDirectory.getCanonicalPath()); 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 Resource _quickStartWebXml;
private String _originAttribute; private String _originAttribute;
private boolean _generateOrigin; private boolean _generateOrigin;
private List<Resource> dependentProjects = new ArrayList<>();
/** /**
* Set the "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern" with a pattern for matching jars on * Set the "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern" with a pattern for matching jars on
@ -321,6 +319,11 @@ public class JettyWebAppContext extends WebAppContext
{ {
return _webInfJars; return _webInfJars;
} }
public List<Resource> getDependentProjects()
{
return dependentProjects;
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void setGenerateQuickStart (boolean quickStart) public void setGenerateQuickStart (boolean quickStart)

View File

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