openrewrite / openrewrite/rewrite

Add RemoveDuplicateDependencies recipe for Gradle

Open
#6,259 2 comments 0 reactions 0 assignees View on GitHub

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

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.