openrewrite / openrewrite/rewrite

org.openrewrite.gradle.RemoveDependency does not remove dependency in subproject

Open
#4,033 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug gradle
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

What version of OpenRewrite are you using?

I am using

  • OpenRewrite BOM 2.6.4
  • Gradle plugin 6.8.2

I've also tested with OpenRewrite 2.7.1 and Gradle plugin 6.8.4.

How are you running OpenRewrite?

I am running OpenRewrite using Gradle, as a multi-module project. The attached zip contains a simplified version of the project structure.

What is the smallest, simplest way to reproduce the problem?

The attached zip reproduces the issue - when using the org.openrewrite.gradle.RemoveDependency to remove a dependency, the specified dependency does not get removed.

What did you expect to see?

The subproject build.gradle should be updated, to remove the dependency

What did you see instead?

The subproject build.gradle does not get updated

Interestingly, if I add the dependency to the top-level build.gradle and run the recipe, both do get removed.

Gradle project with issue reproduced:
OpenRewriteIssueReproduced.zip

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 reproducing the issue with the attached OpenRewriteIssueReproduced.zip and trace the org.openrewrite.gradle.RemoveDependency entry point for a multi-module Gradle project. Compare the root and subproject build.gradle files; done means the specified dependency is removed from the subproject build.gradle as well as the root file when applicable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.