openrewrite / rewrite

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

RemoveDependency: Applying recipes would make no changes. #1583

Closed josemariavillar closed 2 years ago

josemariavillar commented 2 years ago

Good afternoon,

I am trying to remove a dependency from the maven file, but the RemoveDependency recipe is not working correctly. Specifically I want to remove the dependency from my POM:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-dependencies</artifactId>.
    <version>Hoxton.SR9</version>
    <type>pom</type>
</dependency>

When executing the :

- org.openrewrite.maven.RemoveDependency:
      groupId: org.springframework.cloud
      artifactId: spring-cloud-dependencies

The result obtained is not as expected:

[INFO] --- rewrite-maven-plugin:4.22.2:dryRun (default-cli) @ test-project ---
[INFO] Using active recipe(s) [com.yourorg.UpgradePOM]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] Parsing Java main files...
[INFO] Parsing Java test files...
[INFO] Running recipe(s)...
[INFO] Applying recipes would make no changes. No patch file generated.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  47.857 s
[INFO] Finished at: 2022-04-07T13:30:07+02:00
[INFO] ------------------------------------------------------------------------

You can reproduce the problem in the following attached project: https://github.com/josemariavillar/test_project/tree/remove_dependency

Thank you very much for the excellent support you provide

Thanks & regards

pway99 commented 2 years ago

Thanks @josemariavillar, The sample project is very helpful we'll have a look.