## echoproperties

### Description

Displays all the current properties (or a subset of them specified by a nested `<propertyset>`) in the project. The output can be sent to a file if desired. This task can be used as a somewhat contrived means of returning data from an `ant` invocation, but is really for debugging build files.

### Parameters

Attribute | Description | Required
--- | --- | ---
destfile | If specified, the value indicates the name of the file to send the output of the statement to. The generated output file is compatible for loading by any Java application as a property file. | No; by default, output to the log
prefix | a prefix which is used to filter the properties: only properties whose names start with this prefix will be echoed. | No
regex | a regular expression which is used to filter the properties: only those properties whose names match it will be echoed. | No
failonerror | If an error occurs while writing the properties to a file, and this attribute is enabled, then a `BuildException` will be thrown, causing the build to fail. If disabled, then IO errors will be reported as a log statement, and the build will continue without failure from this task. | No; default is true
format | One of text or xml. Determines the output format. | No; defaults to text

### Parameters specified as nested elements

#### propertyset

Since Ant 1.6.

You can specify subsets of properties to be echoed with propertysets. Using `propertyset`s gives more control on which properties will be picked up. The attributes prefix and regex are just shortcuts that use `propertyset`s internally.

### Examples

Report the current properties to the log.

    <echoproperties/>

Report the current properties to the file `my.properties`, and fail the build if the file could not be created or written to.

    <echoproperties destfile="my.properties"/>

Report the current properties to the file `my.properties`, and log a message if the file could not be created or written to, but still allow the build to continue.

    <echoproperties destfile="my.properties" failonerror="false"/>

List all properties beginning with `java.`

    <echoproperties prefix="java."/>

Lists all properties beginning with `java.` using a nested `<propertyset/>` which is an equivalent but longer way.

    <echoproperties>
      <propertyset>
        <propertyref prefix="java."/>
      </propertyset>
    </echoproperties>

Lists all properties that contain `ant` in their names.

    <echoproperties regex=".*ant.*"/>

The equivalent snippet with `<propertyset/>` is:

    <echoproperties>
      <propertyset>
        <propertyref regex=".*ant.*"/>
      </propertyset>
    </echoproperties>