Change maven managed dependency classifier
Ferioney opened this issue · comments
What problem are you trying to solve?
Recipe Change Maven dependency classifier changes classifier only for dependency. In some case I want to change classifier for managed dependency as well.
Describe the situation before applying the recipe
pom.xml
<project>
...
<dependencyManagement>
<dependencies>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<classifier>jar</classifier>
</dependencies>
</dependencyManagement>
</project>
Describe the situation after applying the recipe
pom.xml
<project>
...
<dependencyManagement>
<dependencies>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependencies>
</dependencyManagement>
</project>
Are you interested in [contributing this recipe to OpenRewrite]
It can be implemented by addition an additional check (isManagedDependencyTag(String groupId, String artifactId)
) to the existing recipe:
ChangeDependencyClassifier.isDependencyTag. For backward compatibility this check should be activated via property and disabled by default.
Hi @Ferioney ; thanks for the suggestion and early analysis as well; would love it if you're able to contribute such a change. An @Option
seems like a fine solution; we might want to double check behavior when there's more than one managed dependency of the same groupId and artifactId, but we can discuss that on a PR.