@Mojo(name="jspc",
defaultPhase=PROCESS_CLASSES,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public class JspcMojo
extends org.apache.maven.plugin.AbstractMojo
At runtime, the plugin will use the jspc compiler to precompile jsps and tags.
Note that the same java compiler will be used as for on-the-fly compiled jsps, which will be the Eclipse java compiler.
See Usage Guide for instructions on using this plugin.
Runs jspc compiler to produce .java and .class filesModifier and Type | Class and Description |
---|---|
static class |
JspcMojo.JettyJspC
JettyJspC
Add some extra setters to standard JspC class to help configure it
for running in maven.
|
Modifier and Type | Field and Description |
---|---|
private java.io.File |
classesDirectory
The location of the compiled classes for the webapp
|
static java.lang.String |
END_OF_WEBAPP |
private java.lang.String |
excludes
The comma separated list of file name patters to exclude from compilation.
|
private java.lang.String |
generatedClasses
The destination directory into which to put the compiled jsps.
|
private java.lang.String |
includes
The comma separated list of patterns for file extensions to be processed.
|
private java.lang.String |
insertionMarker
Optional.
|
private JspcMojo.JettyJspC |
jspc
The JspC instance being used to compile the jsps.
|
private boolean |
keepSources
Controls whether or not .java files generated during compilation will be
preserved.
|
private boolean |
mergeFragment
Merge the generated fragment file with the web.xml from
webAppSourceDirectory.
|
private java.util.List<org.apache.maven.artifact.Artifact> |
pluginArtifacts
The artifacts for the plugin itself.
|
static java.lang.String |
PRECOMPILED_FLAG |
private org.apache.maven.project.MavenProject |
project
The maven project.
|
private java.util.Set<org.apache.maven.artifact.Artifact> |
projectArtifacts
The artifacts for the project.
|
private boolean |
scanAllDirectories
Whether dirs on the classpath should be scanned as well as jars.
|
private java.lang.String |
sourceVersion
Source version - if not set defaults to jsp default (currently 1.7)
|
private java.lang.String |
targetVersion
Target version - if not set defaults to jsp default (currently 1.7)
|
private java.lang.String |
tldJarNamePatterns
Patterns of jars on the system path that contain tlds.
|
private boolean |
useProvidedScope
Whether or not to include dependencies on the plugin's classpath with <scope>provided</scope>
Use WITH CAUTION as you may wind up with duplicate jars/classes.
|
private java.lang.String |
webAppSourceDirectory
Root directory for all html/jsp etc files
|
private java.lang.String |
webXml
Location of web.xml.
|
private java.lang.String |
webXmlFragment
File into which to generate the <servlet> and
<servlet-mapping> tags for the compiled jsps
|
Constructor and Description |
---|
JspcMojo() |
Modifier and Type | Method and Description |
---|---|
void |
cleanupSrcs()
Until Jasper supports the option to generate the srcs in a different dir
than the classes, this is the best we can do.
|
void |
compile() |
(package private) static void |
delete(java.io.File dir,
java.io.FileFilter filter) |
void |
execute() |
private java.lang.String |
getJspFiles(java.lang.String webAppSourceDirectory) |
private java.util.Set<java.net.URL> |
getPluginJars() |
private java.util.Set<java.net.URL> |
getProvidedScopeJars(java.util.Set<java.net.URL> pluginJars) |
private java.io.File |
getWebXmlFile() |
void |
mergeWebXml()
Take the web fragment and put it inside a copy of the web.xml.
|
private void |
prepare() |
private java.util.List<java.net.URL> |
setUpWebAppClassPath()
Set up the execution classpath for Jasper.
|
public static final java.lang.String END_OF_WEBAPP
public static final java.lang.String PRECOMPILED_FLAG
@Parameter(defaultValue="false") private boolean useProvidedScope
@Parameter(defaultValue="${project.artifacts}", readonly=true) private java.util.Set<org.apache.maven.artifact.Artifact> projectArtifacts
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${plugin.artifacts}", readonly=true) private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
@Parameter(defaultValue="${basedir}/target/webfrag.xml") private java.lang.String webXmlFragment
@Parameter private java.lang.String insertionMarker
@Parameter(defaultValue="true") private boolean mergeFragment
@Parameter(defaultValue="${project.build.outputDirectory}") private java.lang.String generatedClasses
@Parameter(defaultValue="false") private boolean keepSources
@Parameter(defaultValue="${basedir}/src/main/webapp") private java.lang.String webAppSourceDirectory
@Parameter(defaultValue="${basedir}/src/main/webapp/WEB-INF/web.xml") private java.lang.String webXml
@Parameter(defaultValue="**\\/*.jsp, **\\/*.jspx") private java.lang.String includes
@Parameter(defaultValue="**\\/.svn\\/**") private java.lang.String excludes
@Parameter(defaultValue="${project.build.outputDirectory}") private java.io.File classesDirectory
@Parameter(defaultValue=".*taglibs[^/]*\\.jar|.*jstl[^/]*\\.jar$") private java.lang.String tldJarNamePatterns
@Parameter private java.lang.String sourceVersion
@Parameter private java.lang.String targetVersion
@Parameter private JspcMojo.JettyJspC jspc
@Parameter(defaultValue="true") private boolean scanAllDirectories
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
public void compile() throws java.lang.Exception
java.lang.Exception
private java.lang.String getJspFiles(java.lang.String webAppSourceDirectory) throws java.lang.Exception
java.lang.Exception
public void cleanupSrcs() throws java.lang.Exception
java.lang.Exception
- if unable to clean srcsstatic void delete(java.io.File dir, java.io.FileFilter filter)
public void mergeWebXml() throws java.lang.Exception
java.lang.Exception
- if unable to merge the web xmlprivate void prepare() throws java.lang.Exception
java.lang.Exception
private java.util.List<java.net.URL> setUpWebAppClassPath() throws java.lang.Exception
java.lang.Exception
private java.util.Set<java.net.URL> getPluginJars() throws java.net.MalformedURLException
java.net.MalformedURLException
private java.util.Set<java.net.URL> getProvidedScopeJars(java.util.Set<java.net.URL> pluginJars) throws java.net.MalformedURLException
pluginJars
- java.net.MalformedURLException
private java.io.File getWebXmlFile() throws java.io.IOException
java.io.IOException