Add a new property

Apache 2.0

Adds a new property to a property file. Attempts to place the new property in alphabetical order by the property keys. Whitespace before and after the = must be included in the property and value.

org.openrewrite.properties.AddProperty

Required

The property key to add.

The value of the new property key.

Optional

A comment that will be added to the new property.

Property entries support different delimiters (=, :, or whitespace). The default value is = unless provided the delimiter of the new property entry.

orderedInsertionBoolean

Whether to attempt adding the property in an order following alphabetic sorting. The default value is true.

Choose an insertion point relative to an existing property. Default is Last. Takes precedence over orderedInsertion. If the referenced property does not exist, falls back to default behavior.

The key of an existing property to use as the reference point for the insert mode. Required when insertMode is Before or After.

mod run . --recipe=org.openrewrite.properties.AddProperty \ -P property=management.metrics.enable.process.files \ -P value=newPropValue

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.