Remove duplicate plugin declarations

Apache 2.0

Maven 3.10 and Maven 4 reject duplicate plugin declarations (same groupId and artifactId) with an error, where Maven 3.9 and earlier only warned. This recipe collapses each set of duplicates into the position of the first declaration, preserving the effective model Maven 3 built from them. Maven 3 merged duplicates, with the later declaration taking precedence, whenever there was a declaration to merge them into: always for build plugins, and for plugins in a profile or in plugin management when the main build or a parent also declares the plugin. Otherwise it applied only the last declaration, which is then the one kept.

org.openrewrite.maven.RemoveDuplicatePluginDeclarations
mod run . --recipe=org.openrewrite.maven.RemoveDuplicatePluginDeclarations

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