Skip to content

org.openrewrite.gradle.AddDependency ignores acceptTransitive option #6411

@oQue

Description

@oQue

What version of OpenRewrite are you using?

I am using

  • Gradle plugin v7.13.0
  • org.openrewrite.recipe:rewrite-recipe-bom:3.19.0
  • org.openrewrite.recipe:rewrite-spring (6.19.0 from bom)

How are you running OpenRewrite?

I am using the Gradle plugin, and my project is a single module project.

rewrite {
    activeRecipe(
        "org.mycompany.Recipe"
    )
}

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

type: specs.openrewrite.org/v1beta/recipe
name: org.mycompany.Recipe
displayName: Test Recipe
recipeList:
    - org.openrewrite.gradle.AddDependency:
          groupId: jakarta.persistence
          artifactId: jakarta.persistence-api
          version: 3.0.0
          configuration: implementation
          acceptTransitive: false
plugins {
    java
    id("org.springframework.boot") version "2.7.18"
    id("io.spring.dependency-management") version "1.0.11.RELEASE"
    id("org.openrewrite.rewrite") version "7.13.0"
}

repositories {
    repositories {
        mavenCentral()
    }
}

rewrite {
    activeRecipe(
        "org.mycompany.Recipe"
    )
}

dependencies {
    rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:3.19.0"))
    rewrite("org.openrewrite.recipe:rewrite-spring")

    // has transitive dependency on jakarta.persistence-api
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
}

What did you expect to see?

dependencies {
    rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:3.19.0"))
    rewrite("org.openrewrite.recipe:rewrite-spring")
    
    // has transitive dependency on jakarta.persistence-api
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("jakarta.persistence:jakarta.persistence-api:2.2")
}

What did you see instead?

no changes

What is the full stack trace of any errors you encountered?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions