net.sf.jasperreports.ant

## Class JRAntCompileTask

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.Task
    - - org.apache.tools.ant.taskdefs.MatchingTask
      - - net.sf.jasperreports.ant.JRBaseAntTask
        - - net.sf.jasperreports.ant.JRAntCompileTask

- All Implemented Interfaces:
    java.lang.Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

      public class JRAntCompileTask
      extends JRBaseAntTask

  Ant task for batch-compiling XML report design files. Works like the built-in `javac` Ant task.

  This task can take the following arguments:

  - src
  - destdir
  - compiler
  - classpath
  - tempdir
  - keepjava
  - xmlvalidation
  Of these arguments, the `src` and `destdir` are required. When this task executes, it will recursively scan the `src` and `destdir` looking for XML report design files to compile. This task makes its compile decision based on timestamp and only XML files that have no corresponding .jasper file or where the compiled report design file is older than the XML file will be compiled.
  Version:
    $Id: JRAntCompileTask.java 5877 2013-01-07 19:51:14Z teodord $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)

- - ### Field Summary

    - ### Fields inherited from class net.sf.jasperreports.ant.JRBaseAntTask

      `jasperReportsContext`

    - ### Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask

      `fileset`

    - ### Fields inherited from class org.apache.tools.ant.Task

      `target, taskName, taskType, wrapper`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRAntCompileTask()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkParameters()` Checks that all required attributes have been set and that the supplied values are valid.
    `protected void` | `compile()` Performs the compilation of the selected report design files.
    `org.apache.tools.ant.types.Path` | `createClasspath()` Adds a path to the classpath.
    `org.apache.tools.ant.types.Path` | `createSrc()` Adds a path for source compilation.
    `void` | `execute()` Executes the task.
    `protected void` | `scanDir(java.io.File srcdir, java.io.File destdir, java.lang.String[] files)` Scans the directory looking for source files to be compiled.
    `protected void` | `scanSrc()` Scans the source directories looking for source files to be compiled.
    `void` | `setCompiler(java.lang.String compiler)` Sets the name of the report compiler class to use when compiling the XML report design files.
    `void` | `setDestdir(java.io.File destdir)` Sets the destination directory into which the XML report design files should be compiled.
    `void` | `setKeepjava(boolean keepjava)` Sets a boolean flag that will instruct the Java bytecode report compilers to avoid deletion of the Java source files generated in the temporary working directory during report generation.
    `void` | `setSrcdir(org.apache.tools.ant.types.Path srcdir)` Sets the source directories to find the XML report design files.
    `void` | `setTempdir(java.io.File tempdir)` Sets the temporary working directory into which to store the temporary files generated during XML report design file compilation.
    `void` | `setXmlvalidation(boolean xmlvalidation)` Instructs the XML parser to validate the XML report design file during compilation.

    - ### Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

      `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, XsetIgnore, XsetItems`

    - ### Methods inherited from class org.apache.tools.ant.Task

      `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `clone, getDescription, getLocation, getProject, setDescription, setLocation`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JRAntCompileTask

          public JRAntCompileTask()

  - ### Method Detail

    - #### setSrcdir

          public void setSrcdir(org.apache.tools.ant.types.Path srcdir)

      Sets the source directories to find the XML report design files.
      Parameters:
        `srcdir` - source path

    - #### createSrc

          public org.apache.tools.ant.types.Path createSrc()

      Adds a path for source compilation.
      Returns:
        source path

    - #### setDestdir

          public void setDestdir(java.io.File destdir)

      Sets the destination directory into which the XML report design files should be compiled.
      Parameters:
        `destdir` - destination directory

    - #### setTempdir

          public void setTempdir(java.io.File tempdir)

      Sets the temporary working directory into which to store the temporary files generated during XML report design file compilation. This is only used by the Java bytecode report compilers that need to have the Java source files stored on disk in order to compile them.

      If not set, the temporary working directory will be the current working directory, as specified by the `user.dir` system property.

      Parameters:
        `tempdir` - temporary working directory

    - #### setKeepjava

          public void setKeepjava(boolean keepjava)

      Sets a boolean flag that will instruct the Java bytecode report compilers to avoid deletion of the Java source files generated in the temporary working directory during report generation. This is useful when debugging.
      Parameters:
        `keepjava` - flag for preventing the deletion of generated Java source files

    - #### setCompiler

          public void setCompiler(java.lang.String compiler)

      Sets the name of the report compiler class to use when compiling the XML report design files.

      The specified class should be an implementation of the `JRCompiler` interface. When specified, this value will temporarily override the value of the `jasper.reports.compiler.class` system property.

      Parameters:
        `compiler` - report compiler class name

    - #### createClasspath

          public org.apache.tools.ant.types.Path createClasspath()

      Adds a path to the classpath.
      Returns:
        classpath to use when compiling the report associated Java expressions class

    - #### setXmlvalidation

          public void setXmlvalidation(boolean xmlvalidation)

      Instructs the XML parser to validate the XML report design file during compilation.
      Parameters:
        `xmlvalidation` - flag for enabling/disabling the validation feature of the XML parser

    - #### execute

          public void execute()
                       throws org.apache.tools.ant.BuildException

      Executes the task.
      Overrides:
        `execute` in class `org.apache.tools.ant.Task`
      Throws:
        `org.apache.tools.ant.BuildException`

    - #### checkParameters

          protected void checkParameters()
                                  throws org.apache.tools.ant.BuildException

      Checks that all required attributes have been set and that the supplied values are valid.
      Throws:
        `org.apache.tools.ant.BuildException`

    - #### scanSrc

          protected void scanSrc()
                          throws org.apache.tools.ant.BuildException

      Scans the source directories looking for source files to be compiled.
      Throws:
        `org.apache.tools.ant.BuildException`

    - #### scanDir

          protected void scanDir(java.io.File srcdir,
                     java.io.File destdir,
                     java.lang.String[] files)

      Scans the directory looking for source files to be compiled. The results are returned in the instance variable `reportFilesMap`.
      Parameters:
        `srcdir` - source directory
        `destdir` - destination directory
        `files` - included file names

    - #### compile

          protected void compile()
                          throws org.apache.tools.ant.BuildException

      Performs the compilation of the selected report design files.
      Throws:
        `org.apache.tools.ant.BuildException`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com