openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.04k stars 306 forks source link

Maven: Add ChangeManagedDependencyClassifier #3830

Open melloware opened 7 months ago

melloware commented 7 months ago

Currently there is https://github.com/openrewrite/rewrite/blob/main/rewrite-maven/src/main/java/org/openrewrite/maven/ChangeDependencyClassifier.java

Which changes a Maven Dependency classifier for example:

From:

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>13.0.3</version>
</dependency>

To: (Add classifier jakarta)

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>13.0.3</version>
        <classifier>jakarta</classifier>
</dependency>

However there is no ChangeManagedDependencyClassifier to change a managed dependency classifier? Ideally the above JAVA should do both at the same time or a new ChangeManagedDependencyClassifier could be introduced which is exactly like ChangeDependencyClassifier which a few lines of code changed to check for Managed depenency.

timtebeek commented 7 months ago

Thanks for the suggestion @melloware ! I've started a quick first attempt in

Feel free to chime in there.