Skip to content

Commit 651a327

Browse files
committed
Add test for ChangeParentPom retaining managed version from grandparent
1 parent e1183da commit 651a327

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

rewrite-maven/src/test/java/org/openrewrite/maven/ChangeParentPomTest.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,69 @@ void bringsDownRemovedManagedVersion() {
15641564
)
15651565
);
15661566
}
1567+
1568+
@Issue("https://github.com/openrewrite/rewrite/issues/6770")
1569+
@Test
1570+
void bringsDownRemovedManagedVersionFromGrandparent() {
1571+
rewriteRun(
1572+
spec -> spec.recipe(new ChangeParentPom(
1573+
"org.springframework.boot", "org.springframework.boot",
1574+
"spring-boot-starter-parent", "spring-boot-starter-parent",
1575+
"4.0.2",
1576+
null, null, null, null, null)),
1577+
pomXml(
1578+
"""
1579+
<project>
1580+
<modelVersion>4.0.0</modelVersion>
1581+
<groupId>com.mycompany</groupId>
1582+
<artifactId>child</artifactId>
1583+
<version>1.0.0-SNAPSHOT</version>
1584+
<parent>
1585+
<groupId>org.springframework.boot</groupId>
1586+
<artifactId>spring-boot-starter-parent</artifactId>
1587+
<version>3.5.9</version>
1588+
<relativePath/>
1589+
</parent>
1590+
<dependencies>
1591+
<dependency>
1592+
<groupId>org.springframework.retry</groupId>
1593+
<artifactId>spring-retry</artifactId>
1594+
</dependency>
1595+
</dependencies>
1596+
</project>
1597+
""",
1598+
"""
1599+
<project>
1600+
<modelVersion>4.0.0</modelVersion>
1601+
<groupId>com.mycompany</groupId>
1602+
<artifactId>child</artifactId>
1603+
<version>1.0.0-SNAPSHOT</version>
1604+
<parent>
1605+
<groupId>org.springframework.boot</groupId>
1606+
<artifactId>spring-boot-starter-parent</artifactId>
1607+
<version>4.0.2</version>
1608+
<relativePath/>
1609+
</parent>
1610+
<dependencyManagement>
1611+
<dependencies>
1612+
<dependency>
1613+
<groupId>org.springframework.retry</groupId>
1614+
<artifactId>spring-retry</artifactId>
1615+
<version>2.0.12</version>
1616+
</dependency>
1617+
</dependencies>
1618+
</dependencyManagement>
1619+
<dependencies>
1620+
<dependency>
1621+
<groupId>org.springframework.retry</groupId>
1622+
<artifactId>spring-retry</artifactId>
1623+
</dependency>
1624+
</dependencies>
1625+
</project>
1626+
"""
1627+
)
1628+
);
1629+
}
15671630
}
15681631

15691632
@Issue("https://github.com/openrewrite/rewrite/issues/1753")

0 commit comments

Comments
 (0)