Remove extra property

Apache 2.0

Gradle's ExtraPropertiesExtension is a commonly used mechanism for setting arbitrary key/value pairs on a project. This recipe removes every assignment of the property with the given key, whatever its value, such as ext.foo = 'bar', ext['foo'] = 'bar', ext.set('foo', 'bar'), an assignment in an ext { } block, or Kotlin's extra["foo"] = "bar" and val foo by extra("bar"). An ext { } block left empty is removed as well. Reads of the property are left as they are.

org.openrewrite.gradle.RemoveExtraProperty

Required

The key of the property to remove.

mod run . --recipe=org.openrewrite.gradle.RemoveExtraProperty \ -P key=foo

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