Copy property value

Apache 2.0

Copies a property value from one key to another. The existing key/value pair remains unaffected by this change. If the destination key already exists, its value will be replaced. By default, creates the destination key if it does not exist.

org.openrewrite.properties.CopyValue

Required

The property key to copy the value from. Supports glob patterns.

The property key to copy the value to.

Optional

The file path to the properties file to copy the value from. If null then the value will be copied from any properties file it appears within.

The file path to the properties file to copy the value to. If null then the value will be copied only into the same file it was found in.

createNewKeysBoolean

When the destination key does not already exist, create it. Default is true.

relaxedBindingBoolean

Whether to match the oldPropertyKey using relaxed binding rules. Default is true. Set to false to use exact matching.

mod run . --recipe=org.openrewrite.properties.CopyValue \ -P oldPropertyKey=app.source.property \ -P newPropertyKey=app.destination.property

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