some cleanup per Jan review
Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
parent
86b4870d14
commit
2c60f59325
|
@ -32,6 +32,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -588,7 +589,9 @@ public class JettyRunMojo extends AbstractJettyMojo
|
|||
MavenProject mavenProject = getProjectReferences( artifact, project );
|
||||
if (mavenProject != null)
|
||||
{
|
||||
dependencyFiles.add( Paths.get(mavenProject.getBuild().getOutputDirectory()).toFile() );
|
||||
File projectPath = Paths.get(mavenProject.getBuild().getOutputDirectory()).toFile();
|
||||
getLog().debug( "Adding project directory " + projectPath.toString() );
|
||||
dependencyFiles.add( projectPath );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ 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
|
||||
|
@ -320,9 +319,9 @@ public class JettyWebAppContext extends WebAppContext
|
|||
return _webInfJars;
|
||||
}
|
||||
|
||||
public List<Resource> getDependentProjects()
|
||||
public List<File> getWebInfClasses()
|
||||
{
|
||||
return dependentProjects;
|
||||
return _webInfClasses;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -84,23 +84,6 @@ public class MavenWebInfConfiguration extends WebInfConfiguration
|
|||
context.setServerClasses( newServerClasses );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.webapp.WebInfConfiguration#preConfigure(org.eclipse.jetty.webapp.WebAppContext)
|
||||
*/
|
||||
public void preConfigure(WebAppContext context) throws Exception
|
||||
{
|
||||
super.preConfigure(context);
|
||||
// ((JettyWebAppContext)context).getDependentProjects()
|
||||
// .stream().forEach( resource -> context.getMetaData().addWebInfJar( resource ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jetty.webapp.AbstractConfiguration#postConfigure(org.eclipse.jetty.webapp.WebAppContext)
|
||||
*/
|
||||
|
@ -197,24 +180,26 @@ public class MavenWebInfConfiguration extends WebInfConfiguration
|
|||
protected List<Resource> findJars (WebAppContext context)
|
||||
throws Exception
|
||||
{
|
||||
List<Resource> list = new ArrayList<Resource>();
|
||||
List<Resource> list = new ArrayList<>();
|
||||
JettyWebAppContext jwac = (JettyWebAppContext)context;
|
||||
if (jwac.getClassPathFiles() != null)
|
||||
List<File> files = jwac.getWebInfLib();
|
||||
if (files != null)
|
||||
{
|
||||
for (File f: jwac.getClassPathFiles())
|
||||
{
|
||||
if (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar"))
|
||||
files.forEach( file -> {
|
||||
if (file.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")
|
||||
|| file.isDirectory())
|
||||
{
|
||||
try
|
||||
{
|
||||
list.add(Resource.newResource(f.toURI()));
|
||||
LOG.debug( " add resource to resources to examine {}", file );
|
||||
list.add(Resource.newResource(file.toURI()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.warn("Bad url ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
List<Resource> superList = super.findJars(context);
|
||||
|
@ -234,25 +219,26 @@ public class MavenWebInfConfiguration extends WebInfConfiguration
|
|||
@Override
|
||||
protected List<Resource> findClassDirs(WebAppContext context) throws Exception
|
||||
{
|
||||
List<Resource> list = new ArrayList<Resource>();
|
||||
List<Resource> list = new ArrayList<>();
|
||||
|
||||
JettyWebAppContext jwac = (JettyWebAppContext)context;
|
||||
if (jwac.getClassPathFiles() != null)
|
||||
List<File> files = jwac.getWebInfClasses();
|
||||
if (files != null)
|
||||
{
|
||||
for (File f: jwac.getClassPathFiles())
|
||||
{
|
||||
if (f.exists() && f.isDirectory())
|
||||
files.forEach( file -> {
|
||||
if (file.exists() && file.isDirectory())
|
||||
{
|
||||
try
|
||||
{
|
||||
list.add(Resource.newResource(f.toURI()));
|
||||
list.add(Resource.newResource(file.toURI()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.warn("Bad url ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
List<Resource> classesDirs = super.findClassDirs(context);
|
||||
|
|
Loading…
Reference in New Issue