Skip to content

Applying AddJaxwsRuntime adds invalid dependency #760

@BrendanHart

Description

@BrendanHart

What version of OpenRewrite are you using?

I am using

  • rewrite-migrate-java latest.release
  • Maven/Gradle plugin latest.release

How are you running OpenRewrite?

I am using a Groovy init script.

initscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2" }
    }
    dependencies { classpath("org.openrewrite:plugin:latest.release") }
}
rootProject {
    plugins.apply(org.openrewrite.gradle.RewritePlugin)
    dependencies {
        rewrite("org.openrewrite.recipe:rewrite-migrate-java:latest.release")

    }
    rewrite {
        activeRecipe("org.openrewrite.java.migrate.javax.AddJaxwsRuntime")
    }
    afterEvaluate {
        if (repositories.isEmpty()) {
            repositories {
                mavenCentral()
            }
        }
    }
}

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

plugins {
    id 'java'
}
repositories {
    mavenCentral()
}
dependencies {
    compileOnly "com.sun.xml.ws:jaxws-rt:2.3.7"

    implementation "org.springframework.boot:spring-boot-starter-web-services:2.5.15"

    testImplementation "com.sun.xml.ws:jaxws-rt:2.3.7"
}

What did you expect to see?

The output only contains valid dependencies.

What did you see instead?

plugins {
    id 'java'
}
repositories {
    mavenCentral()
}
dependencies {
    compileOnly "com.sun.xml.ws:jaxws-rt:2.3.7"

    implementation "org.springframework.boot:spring-boot-starter-web-services:2.5.15"

    runtimeClasspath "com.sun.xml.ws:jaxws-rt:2.3.7"

    testImplementation "com.sun.xml.ws:jaxws-rt:2.3.7"
}

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

When we build this we see:

> Dependencies can not be declared against the `runtimeClasspath` configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions