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.
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 |