From bf7f47b4f8639aae030181f30f99762013494a60 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Tue, 3 Sep 2024 10:51:08 +0200 Subject: [PATCH] Also exclude omitted dependencies --- .../maven/ExcludeDependencyTest.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/rewrite-maven/src/test/java/org/openrewrite/maven/ExcludeDependencyTest.java b/rewrite-maven/src/test/java/org/openrewrite/maven/ExcludeDependencyTest.java index fd741445aba..4008b55c826 100644 --- a/rewrite-maven/src/test/java/org/openrewrite/maven/ExcludeDependencyTest.java +++ b/rewrite-maven/src/test/java/org/openrewrite/maven/ExcludeDependencyTest.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test; import org.openrewrite.DocumentExample; import org.openrewrite.Issue; +import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; @@ -234,4 +235,68 @@ void respectTransitiveDependencyOriginalScopeWhenDeterminingIfExclusionIsNecessa """) ); } + + @Test + void excludeAlsoWhereConflictOmitted() { + rewriteRun( + spec -> spec + .recipe(new ExcludeDependency("org.apache.logging.log4j", "log4j-api", null)), + pomXml( + """ + + 4.0.0 + com.example + demo + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter + 2.7.18 + + + + org.opensearch.client + spring-data-opensearch-starter + 1.3.0 + + + + """, + """ + + 4.0.0 + com.example + demo + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter + 2.7.18 + + + org.apache.logging.log4j + log4j-api + + + + + + org.opensearch.client + spring-data-opensearch-starter + 1.3.0 + + + org.apache.logging.log4j + log4j-api + + + + + + """ + ) + ); + } }