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
+
+
+
+
+
+ """
+ )
+ );
+ }
}