diff --git a/rewrite-gradle/src/test/java/org/openrewrite/gradle/AddDependencyTest.java b/rewrite-gradle/src/test/java/org/openrewrite/gradle/AddDependencyTest.java index 981d6f5b75f..76bc39e6f25 100644 --- a/rewrite-gradle/src/test/java/org/openrewrite/gradle/AddDependencyTest.java +++ b/rewrite-gradle/src/test/java/org/openrewrite/gradle/AddDependencyTest.java @@ -87,6 +87,27 @@ void onlyIfUsingCompileScope(String onlyIfUsing) { ); } + @Test + void addDependencyWithClassifier() { + AddDependency addDep = new AddDependency("io.netty", "netty-tcnative-boringssl-static", "2.0.54.Final", null, "implementation", "com.google.common.math.IntMath", "linux-x86_64", null, null); + rewriteRun( + spec -> spec.recipe(addDep), + mavenProject("project", + srcMainJava( + java(usingGuavaIntMath) + ), + buildGradle( + "", + """ + dependencies { + implementation "io.netty:netty-tcnative-boringssl-static:2.0.54.Final:linux-x86_64" + } + """ + ) + ) + ); + } + @Test void notUsingType() { rewriteRun( diff --git a/rewrite-maven/src/test/java/org/openrewrite/maven/AddDependencyTest.java b/rewrite-maven/src/test/java/org/openrewrite/maven/AddDependencyTest.java index a7995389b6a..99e2052a780 100755 --- a/rewrite-maven/src/test/java/org/openrewrite/maven/AddDependencyTest.java +++ b/rewrite-maven/src/test/java/org/openrewrite/maven/AddDependencyTest.java @@ -158,6 +158,47 @@ void onlyIfUsingCompileScope(String onlyIfUsing) { ); } + @Test + void addDependencyWithClassifier() { + AddDependency addDep = new AddDependency( + "io.netty", "netty-tcnative-boringssl-static", "2.0.54.Final", null, "compile", true, + "com.google.common.math.IntMath", null, "linux-x86_64", false, null + ); + rewriteRun( + spec -> spec.recipe(addDep), + mavenProject( + "project", + srcMainJava( + java(usingGuavaIntMath) + ), + pomXml( + """ + + com.mycompany.app + my-app + 1 + + """, + """ + + com.mycompany.app + my-app + 1 + + + io.netty + netty-tcnative-boringssl-static + 2.0.54.Final + linux-x86_64 + + + + """ + ) + ) + ); + } + @Test void notUsingType() { rewriteRun(