-
Notifications
You must be signed in to change notification settings - Fork 8
Simplify ChangeDependency duplicates following openrewrite/rewrite#6406 #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@BoykoAlex a quick headsup that for some reason I'm not yet seeing the effects you were after for Gradle. Just in case you run into it there as well. |
|
Hmm... if there is a quick unit test you could drop in |
|
Sure; in rewite-gradle that would be @Test
void noDuplicateJacksonDatabindDependenciesInGradle() {
rewriteRun(
spec -> spec.beforeRecipe(withToolingApi())
.recipes(
new ChangeDependency(
"com.fasterxml.jackson.core",
"jackson-databind",
"tools.jackson.core",
null,
"3.0.x",
null,
null,
null
),
new ChangeDependency(
"com.fasterxml.jackson.datatype",
"jackson-datatype-jsr310",
"tools.jackson.core",
"jackson-databind",
"3.0.x",
null,
null,
null
)
),
buildGradle(
//language=gradle
"""
plugins {
id("java-library")
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:2.19.0")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.0")
}
""",
spec -> spec.after(buildGradle ->
assertThat(buildGradle)
.doesNotContain("jackson-datatype")
.containsOnlyOnce("jackson-databind")
.actual())
)
);
}Which fails with |
|
This helps: However, I'm somewhat uncomfortable about computing |
|
Great to see this simplification; thanks again @BoykoAlex ! And best wishes for the new year. :) |
ChangeDependencyrecipes rewrite#6406