## Export Ant Task |

| The export ant task can be used to export views from a saved snapshot. For more information please consult the overview.

| You can integrate the command line export with your ant script (read about ant at ant.apache.org) by using the `export` task that is provided in `{JProfiler installation directory}/bin/ant.jar`. To make the `export` task available to ant, you must first insert a `taskdef` element that tells ant where to find the task definition. Here is an example of using the task in an ant build file:
          <taskdef name="export"
                   classname="com.jprofiler.ant.ExportTask"
                   classpath="C:\Program Files\jprofiler4\bin\ant.jar"/>

          <target name="export">
            <export snapshotfile="c:\home\ingo\test.jps">
              <view name="CallTree" file="calltree.html"/>
              <view name="HotSpots" file="hotspots.html">
                <option name="expandbacktraces" value="true"/>
                <option name="aggregation" value="class"/>
              </view>
            </export>
          </target>
The `taskdef` definition must occur only once per ant-build file and can appear anywhere on the top level below the `project` element. Note: it is not possible to copy the `ant.jar` archive to the `lib` folder of your ant distribution. You have to reference a full installation of JProfiler in the task definition.

| The `export` task supports the following attributes:
Attribute | Description | Required
--- | --- | ---
snapshotfile | The path to the snapshot file. This must be a file with a `.jps` extension. | Yes
session | An alternate session from which the view settings should be taken. The session id can be found in the application settings next to the session name. By default, the view settings are taken from the session that is embedded inside the snapshot file. | No
ignoreerrors | Ignore errors that occur when options for a view cannot be set and continue with the next view. The default value is "false", i.e. the export is terminated, when the first error occurs. | No
The export task contains a list of view elements with the following attributes:
Attribute | Description | Required
--- | --- | ---
name | The view name. For a list of available view names, please see the help page on the command line executable. extension. | Yes
file | The output file name. The process for the output format selection is described in the overview. | Yes
The view element can optionally contain a list of option elements with the following attributes:
Attribute | Description | Required
--- | --- | ---
name | The option name. Each view has its own set of options. For a list of available view names and the corresponding options, please see the help page on the command line executable. | Yes
value | The value of the option. | Yes