diff options
author | Jan Bartel | 2015-03-20 04:51:22 +0000 |
---|---|---|
committer | Jan Bartel | 2015-03-20 04:51:22 +0000 |
commit | f6b4be9abe27014a8ceced595345e4ed3708c65f (patch) | |
tree | a2f07c1ac4e44a98e1039e94033d461c82f8189b /jetty-jspc-maven-plugin | |
parent | 7c53dfe5a4c27f10a5af1b17b0b3c3b9ff8706c2 (diff) | |
download | org.eclipse.jetty.project-f6b4be9abe27014a8ceced595345e4ed3708c65f.tar.gz org.eclipse.jetty.project-f6b4be9abe27014a8ceced595345e4ed3708c65f.tar.xz org.eclipse.jetty.project-f6b4be9abe27014a8ceced595345e4ed3708c65f.zip |
457508 Add flag to scan exploded jars in jetty-jspc-maven-plugin
Diffstat (limited to 'jetty-jspc-maven-plugin')
-rw-r--r-- | jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java b/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java index 99ba965b19..dd7d614c49 100644 --- a/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java +++ b/jetty-jspc-maven-plugin/src/main/java/org/eclipse/jetty/jspc/plugin/JspcMojo.java @@ -35,11 +35,15 @@ import java.util.Set; import java.util.regex.Pattern; import org.apache.jasper.JspC; +import org.apache.jasper.servlet.JspCServletContext; +import org.apache.jasper.servlet.TldScanner; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; +import org.apache.tomcat.JarScanner; +import org.apache.tomcat.util.scan.StandardJarScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; import org.eclipse.jetty.util.IO; @@ -73,7 +77,7 @@ import org.eclipse.jetty.util.resource.Resource; * * @goal jspc * @phase process-classes - * @requiresDependencyResolution compile + * @requiresDependencyResolution compile+runtime * @description Runs jspc compiler to produce .java and .class files */ public class JspcMojo extends AbstractMojo @@ -87,13 +91,42 @@ public class JspcMojo extends AbstractMojo * * Add some extra setters to standard JspC class to help configure it * for running in maven. + * + * TODO move all setters on the plugin onto this jspc class instead. */ public static class JettyJspC extends JspC { + + private boolean scanAll; + public void setClassLoader (ClassLoader loader) { this.loader = loader; } + + public void setScanAllDirectories (boolean scanAll) + { + this.scanAll = scanAll; + } + + public boolean getScanAllDirectories () + { + return this.scanAll; + } + + + @Override + protected TldScanner newTldScanner(JspCServletContext context, boolean namespaceAware, boolean validate, boolean blockExternal) + { + if (context != null && context.getAttribute(JarScanner.class.getName()) == null) + { + StandardJarScanner jarScanner = new StandardJarScanner(); + jarScanner.setScanAllDirectories(getScanAllDirectories()); + context.setAttribute(JarScanner.class.getName(), jarScanner); + } + + return super.newTldScanner(context, namespaceAware, validate, blockExternal); + } } @@ -237,7 +270,14 @@ public class JspcMojo extends AbstractMojo private JettyJspC jspc; - + /** + * Whether dirs on the classpath should be scanned as well as jars. + * True by default. This allows for scanning for tlds of dependent projects that + * are in the reactor as unassembled jars. + * + * @parameter default-value=true + */ + private boolean scanAllDirectories; public void execute() throws MojoExecutionException, MojoFailureException @@ -311,11 +351,13 @@ public class JspcMojo extends AbstractMojo if (jspc == null) jspc = new JettyJspC(); + jspc.setWebXmlFragment(webXmlFragment); jspc.setUriroot(webAppSourceDirectory); jspc.setOutputDir(generatedClasses); jspc.setClassPath(sysClassPath+System.getProperty("path.separator")+webAppClassPath.toString()); jspc.setClassLoader(fakeWebAppClassLoader); + jspc.setScanAllDirectories(scanAllDirectories); jspc.setCompile(true); // JspC#setExtensions() does not exist, so |