diff --git a/rewrite-maven/src/test/java/org/openrewrite/maven/UpgradePluginVersionTest.java b/rewrite-maven/src/test/java/org/openrewrite/maven/UpgradePluginVersionTest.java
index db6ca2afb11..f84e4559b46 100644
--- a/rewrite-maven/src/test/java/org/openrewrite/maven/UpgradePluginVersionTest.java
+++ b/rewrite-maven/src/test/java/org/openrewrite/maven/UpgradePluginVersionTest.java
@@ -736,4 +736,192 @@ void defaultPluginGroupId() {
)
);
}
+
+ @Test
+ void pluginUpgradeWithProfiles() {
+ rewriteRun(
+ spec -> spec.recipe(new UpgradePluginVersion(
+ "org.jacoco",
+ "jacoco-maven-plugin",
+ "0.8.12",
+ null,
+ null,
+ null
+ )),
+ pomXml(
+ """
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.3.3
+
+
+ com.example
+ recipe-test-project
+ 0.0.1-SNAPSHOT
+ recipe-test-project
+ recipe-test-project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 21
+ 0.8.7
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+
+
+
+ p1
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+
+
+
+
+ """,
+ """
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.3.3
+
+
+ com.example
+ recipe-test-project
+ 0.0.1-SNAPSHOT
+ recipe-test-project
+ recipe-test-project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 21
+ 0.8.12
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+
+
+
+ p1
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+
+
+
+
+ """
+ )
+ );
+ }
}