Save This Page
Home » apache-ant-1.7.1-src » org.apache.tools » ant » taskdefs » optional » jsp » [javadoc | source]
org.apache.tools.ant.taskdefs.optional.jsp
public class: JspC [javadoc | source]
java.lang.Object
   org.apache.tools.ant.ProjectComponent
      org.apache.tools.ant.Task
         org.apache.tools.ant.taskdefs.MatchingTask
            org.apache.tools.ant.taskdefs.optional.jsp.JspC

All Implemented Interfaces:
    SelectorContainer, Cloneable

Runs a JSP compiler.

This task takes the given jsp files and compiles them into java files. It is then up to the user to compile the java files into classes.

The task requires the srcdir and destdir attributes to be set. This Task is a MatchingTask, so the files to be compiled can be specified using includes/excludes attributes or nested include/exclude elements. Optional attributes are verbose (set the verbosity level passed to jasper), package (name of the destination package for generated java classes and classpath (the classpath to use when running the jsp compiler).

This task supports the nested elements classpath (A Path) and classpathref (A Reference) which can be used in preference to the attribute classpath, if the jsp compiler is not already in the ant classpath.

Usage

<jspc srcdir="${basedir}/src/war"
destdir="${basedir}/gensrc"
package="com.i3sp.jsp"
verbose="9">
<include name="**\/*.jsp" />
</jspc>

Large Amount of cutting and pasting from the Javac task...

Nested Class Summary:
public static class  JspC.WebAppParameter  static inner class used as a parameter element 
Field Summary
protected  Vector compileList     
 Vector javaFiles     
protected  boolean failOnError    flag to control action on execution trouble 
protected  JspC.WebAppParameter webApp    web apps 
Fields inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset
Fields inherited from org.apache.tools.ant.Task:
target,  taskName,  taskType,  wrapper
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
Method from org.apache.tools.ant.taskdefs.optional.jsp.JspC Summary:
addWebApp,   createClasspath,   createCompilerclasspath,   deleteEmptyJavaFiles,   execute,   getClasspath,   getCompileList,   getCompilerclasspath,   getDestdir,   getFailonerror,   getIeplugin,   getPackage,   getSrcDir,   getUribase,   getUriroot,   getVerbose,   getWebApp,   getWebinc,   getWebxml,   isMapped,   mapToJavaFile,   resetFileLists,   scanDir,   setClasspath,   setClasspathRef,   setCompiler,   setCompilerclasspath,   setDestdir,   setFailonerror,   setIeplugin,   setMapped,   setPackage,   setSrcDir,   setUribase,   setUriroot,   setVerbose,   setWebinc,   setWebxml
Methods from org.apache.tools.ant.taskdefs.MatchingTask:
XsetIgnore,   XsetItems,   add,   addAnd,   addContains,   addContainsRegexp,   addCustom,   addDate,   addDepend,   addDepth,   addDifferent,   addFilename,   addMajority,   addModified,   addNone,   addNot,   addOr,   addPresent,   addSelector,   addSize,   addType,   appendSelector,   createExclude,   createExcludesFile,   createInclude,   createIncludesFile,   createPatternSet,   getDirectoryScanner,   getImplicitFileSet,   getSelectors,   hasSelectors,   selectorCount,   selectorElements,   setCaseSensitive,   setDefaultexcludes,   setExcludes,   setExcludesfile,   setFollowSymlinks,   setIncludes,   setIncludesfile,   setProject
Methods from org.apache.tools.ant.Task:
bindToOwner,   execute,   getOwningTarget,   getRuntimeConfigurableWrapper,   getTaskName,   getTaskType,   getWrapper,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   init,   isInvalid,   log,   log,   log,   log,   markInvalid,   maybeConfigure,   perform,   reconfigure,   setOwningTarget,   setRuntimeConfigurableWrapper,   setTaskName,   setTaskType
Methods from org.apache.tools.ant.ProjectComponent:
clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.taskdefs.optional.jsp.JspC Detail:
 public  void addWebApp(JspC.WebAppParameter webappParam) throws BuildException 
    Adds a single webapp.
 public Path createClasspath() 
    Adds a path to the classpath.
 public Path createCompilerclasspath() 
    Support nested compiler classpath, used to locate compiler adapter
 public  void deleteEmptyJavaFiles() 
    delete any java output files that are empty this is to get around a little defect in jasper: when it fails, it leaves incomplete files around.
 public  void execute() throws BuildException 
    execute by building up a list of files that have changed and hand them off to a jsp compiler
 public Path getClasspath() 
    Get the classpath.
 public Vector getCompileList() 
    get the list of files to compile
 public Path getCompilerclasspath() 
    get the classpath used to find the compiler adapter
 public File getDestdir() 
    Get the destination directory.
 public boolean getFailonerror() 
    Gets the failonerror flag.
 public String getIeplugin() 
    Get the IE CLASSID value.
 public String getPackage() 
    Get the name of the package.
 public Path getSrcDir() 
    Get the source dir.
 public File getUribase() 
    Get the uri base value.
 public File getUriroot() 
    Get the uri root value.
 public int getVerbose() 
    Get the verbose level.
 public JspC.WebAppParameter getWebApp() 
    Get the web app.
 public File getWebinc() 
    Get the webinc attribute.
 public File getWebxml() 
    Filename for web.xml.
 public boolean isMapped() 
    If true, generate separate write() calls for each HTML line in the JSP.
 protected File mapToJavaFile(JspMangler mangler,
    File srcFile,
    File srcDir,
    File dest) 
    get a filename from our jsp file.
 protected  void resetFileLists() 
    Clear the list of files to be compiled and copied..
 protected  void scanDir(File srcDir,
    File dest,
    JspMangler mangler,
    String[] files) 
    Scans the directory looking for source files to be compiled. The results are returned in the class variable compileList
 public  void setClasspath(Path cp) 
    Set the classpath to be used for this compilation.
 public  void setClasspathRef(Reference r) 
    Adds a reference to a classpath defined elsewhere
 public  void setCompiler(String compiler) 
    Class name of a JSP compiler adapter.
 public  void setCompilerclasspath(Path cp) 
    Set the classpath to be used to find this compiler adapter
 public  void setDestdir(File destDir) 
    Set the destination directory into which the JSP source files should be compiled.
 public  void setFailonerror(boolean fail) 
    Whether or not the build should halt if compilation fails. Defaults to true.
 public  void setIeplugin(String iepluginid) 
    Java Plugin CLASSID for Internet Explorer
 public  void setMapped(boolean mapped) 
    If true, generate separate write() calls for each HTML line in the JSP.
 public  void setPackage(String pkg) 
    Set the name of the package the compiled jsp files should be in.
 public  void setSrcDir(Path srcDir) 
    Set the path for source JSP files.
 public  void setUribase(File uribase) 
    The URI context of relative URI references in the JSP pages. If it does not exist then it is derived from the location of the file relative to the declared or derived value of uriroot.
 public  void setUriroot(File uriroot) 
    The root directory that uri files should be resolved against. (Default is the directory jspc is invoked from)
 public  void setVerbose(int i) 
    Set the verbose level of the compiler
 public  void setWebinc(File webinc) 
    output filename for the fraction of web.xml that lists servlets.
 public  void setWebxml(File webxml) 
    Filename for web.xml.