Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,60 @@ void upgradeVersionDefinedViaImplicitPropertyInRemoteParent() {
);
}

@Test
void upgradesExistingParentOverridePropertyInSamePom() {
// Child pom redeclares a parent-managed version property below the managed value.
// overrideManagedVersion=true should bump that local property rather than leaving it orphaned
// (or adding a redundant explicit <version> that RemoveRedundantDependencyVersions would strip).
rewriteRun(
spec -> spec.recipe(new UpgradeDependencyVersion("org.flywaydb", "flyway-core", "10.15.0", "", true, null)),
pomXml(
"""
<project>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.3.0</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>my-child</artifactId>
<version>1</version>
<properties>
<flyway.version>10.10.0</flyway.version>
</properties>
<dependencies>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
</dependencies>
</project>
""",
"""
<project>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.3.0</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>my-child</artifactId>
<version>1</version>
<properties>
<flyway.version>10.15.0</flyway.version>
</properties>
<dependencies>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
</dependencies>
</project>
"""
)
);
}

@Issue("https://github.com/openrewrite/rewrite/issues/4193")
@Test
void upgradeVersionDefinedViaExplicitPropertyInRemoteParent() {
Expand Down