ChangeDependency/ChangePackage and transitive/dependencies #4980
-
I'm using org.openrewrite.apache.commons.collections.UpgradeApacheCommonsCollections_3_4 on a Maven project and stumbled on a case where it looks like the recipe doesn't work so well if collection(3) was coming from a transitive dependency. I have multiple questions, but my main one is this: If I use changedependency/changepackage but somehow I ultimately don't get the dependency that provides the new package added, should that trigger some error? I got a compiler error about |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What's the context of your recipe run here? Are you running this recipe in isolation or as part of a larger composite? It's hard to say at times what recipes should and should not change in a project. The recipe might run as part of a larger composite where we rely on another recipe to switch to a different transitive dependency, or it might be run in isolation where a new explicit dependency might need to be added. In the past we've seen over eager addition of explicit dependencies as a source of frustration, so we've become cautious in adding those where they might not be needed. We could adjust the recipe here to add the dependency if not present transitively, and only if using the old package name before the migration. I'd welcome a PR towards that end if you're up for it. |
Beta Was this translation helpful? Give feedback.
What's the context of your recipe run here? Are you running this recipe in isolation or as part of a larger composite?
It's hard to say at times what recipes should and should not change in a project. The recipe might run as part of a larger composite where we rely on another recipe to switch to a different transitive dependency, or it might be run in isolation where a new explicit dependency might need to be added. In the past we've seen over eager addition of explicit dependencies as a source of frustration, so we've become cautious in adding those where they might not be needed.
We could adjust the recipe here to add the dependency if not present transitively, and only if using the old…