openrewrite / openrewrite/rewrite
Add RemoveDuplicateDependencies recipe for Gradle
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What problem are you trying to solve?
For Maven, there is a RemoveDuplicateDependencies recipe to remove duplicate dependencies from a project.
I would like to have the same functionality for Gradle projects.
What precondition(s) should be checked before applying this recipe?
Gradle projects
Describe the situation before applying the recipe
- This new recipe would be useful to solve a bug in the Jackson recipe as described in https://github.com/openrewrite/rewrite-jackson/issues/37.
In that case, when the input is:
implementation "com.fasterxml.jackson.core:jackson-databind"
implementation "com.fasterxml.jackson.module:jackson-module-parameter-names"
the output is:
implementation "tools.jackson.core:jackson-databind"
implementation "tools.jackson.core:jackson-databind"
Describe the situation after applying the recipe
In the case described above, I'd like the output to be:
implementation "tools.jackson.core:jackson-databind"
Have you considered any alternatives or workarounds?
I haven't found alternative strategies except writing a custom recipe.
Are you interested in contributing this recipe to OpenRewrite?
Yes, with some guidance
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading rewrite-maven/src/main/java/org/openrewrite/maven/RemoveDuplicateDependencies.java, the existing Maven analogue. Use the Jackson issue linked in the description and its before/after examples as the behavioral reference; done means a Gradle project with duplicate dependencies produces one remaining dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- build-system, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100