WriteProperties

API Documentation:WriteProperties

Note: This class is incubating and may change in a future version of Gradle.

Writes a Properties in a way that the results can be expected to be reproducible.

There are a number of differences compared to how properties are stored:

  • no timestamp comment is generated at the beginning of the file
  • the lines in the resulting files are separated by a pre-set separator (defaults to '\n') instead of the system default line separator
  • the properties are sorted alphabetically

Like with Properties, Unicode characters are escaped when using the default Latin-1 (ISO-8559-1) encoding.

Properties

PropertyDescription
comment
Incubating

The optional comment to add at the beginning of the properties file.

encoding
Incubating

The encoding used to write the properties file. Defaults to ISO_8859_1. If set to anything different, unicode escaping is turned off.

lineSeparator
Incubating

The line separator to be used when creating the properties file. Defaults to `\n`.

outputFile
Incubating

The output file to write the properties to.

properties
Incubating

The properties to be written to the output file.

Methods

No methods

Script blocks

No script blocks

Property details

String comment

Note: This property is incubating and may change in a future version of Gradle.

The optional comment to add at the beginning of the properties file.

Default:
null

String encoding

Note: This property is incubating and may change in a future version of Gradle.

The encoding used to write the properties file. Defaults to ISO_8859_1. If set to anything different, unicode escaping is turned off.

Default:
ISO-8859-1

String lineSeparator

Note: This property is incubating and may change in a future version of Gradle.

The line separator to be used when creating the properties file. Defaults to `\n`.

Default:
'\n'

File outputFile

Note: This property is incubating and may change in a future version of Gradle.

The output file to write the properties to.

Default:
null

Properties properties

Note: This property is incubating and may change in a future version of Gradle.

The properties to be written to the output file.

Default:
[:]