Add or update child tag

Apache 2.0

Adds or updates a child element below the parent(s) matching the provided parentXPath expression. If a child with the same name already exists, it will be replaced by default. Otherwise, a new child will be added. This ensures idempotent behaviour.

org.openrewrite.xml.AddOrUpdateChildTag

Required

XPath identifying the parent to which a child tag must be added

The XML of the new child to add or update on the parent tag.

Optional

replaceExistingBoolean

Set to false to not replace the child tag if it already exists. Defaults to true.

mod run . --recipe=org.openrewrite.xml.AddOrUpdateChildTag \ -P parentXPath=/project//plugin//configuration \ -P newChildTag='<skip>true</skip>'

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