rewrite
rewrite copied to clipboard
RemoveRedundantDependencyVersions for Plugins
What problem are you trying to solve?
Like dependencies, plugins can also have redundant versions when compared to the pluginManagement
. But, RemoveRedundantDependencyVersions
only touches dependencies.
What precondition(s) should be checked before applying this recipe?
Can't think of any
Describe the situation before applying the recipe
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/>
</parent>
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.9.10</version>
</plugin>
</plugins>
</build>
</project>
Describe the situation after applying the recipe
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/>
</parent>
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Have you considered any alternatives or workarounds?
Implementation options could include:
- Add this to
RemoveRedundantDependencyVersions
- Same as above, but with an arg to control the plugin-handling behavior
- Choice about whether to default the behavior to on or off
- Create a new, separate
RemoveRedundantPluginVersions
I'd vote for adding it to RemoveRedundantDependencyVersions
, active by default, with a new optional arg to disable checking plugins.
Any additional context
Are you interested in contributing this recipe to OpenRewrite?
I might; priority TBA. This might also be a good first issue for someone else.
Good suggestion indeed! I'd also opt to add it to the existing RemoveRedundantDependencyVersions
.