Skip to content

Add Apache POI 5.x upgrade recipe#120

Open
krlittle wants to merge 2 commits intomainfrom
krlittle/poi-5x-upgrade
Open

Add Apache POI 5.x upgrade recipe#120
krlittle wants to merge 2 commits intomainfrom
krlittle/poi-5x-upgrade

Conversation

@krlittle
Copy link
Contributor

@krlittle krlittle commented Feb 17, 2026

Summary

  • Adds UpgradeApachePoi_5 recipe that chains UpgradeApachePoi_4_1 and handles POI 5.0 artifact renames (poi-ooxml-schemaspoi-ooxml-lite, ooxml-schemaspoi-ooxml-full), removes the merged ooxml-security dependency, and upgrades all POI artifacts to 5.x
  • Purely declarative YAML recipe using existing OpenRewrite primitives (ChangeDependency, RemoveDependency, UpgradeDependencyVersion)
  • Includes 5 unit tests covering artifact renames, dependency removal, version upgrades, and older 5.x upgrades

Test plan

  • All 5 UpgradeApachePoi_5Test cases pass
  • Full test suite passes with no regressions
  • Dry-run validated against krlittle/sample-apache-poi-project (POI 3.17 Gradle project) with Gradle 8.14 / JDK 21 — full 3.17 → 4.1 → 5.x chain produces expected patch

Supporting documentation

Adds UpgradeApachePoi_5 which chains the 4.1 recipe and handles the
POI 5.0 artifact renames (poi-ooxml-schemas -> poi-ooxml-lite,
ooxml-schemas -> poi-ooxml-full), removes the merged ooxml-security
dependency, and upgrades all POI artifacts to 5.x.

Also copies the 4.1 recipe from the valencia worktree so the full
3.17 -> 4.1 -> 5.x chain is present and testable.
spec -> spec.after(pom -> {
Matcher version = Pattern.compile("5\\.\\d+\\.\\d+").matcher(pom);
assertThat(version.find()).describedAs("Expected 5.x in %s", pom).isTrue();
String poiVersion = version.group();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an older style of asserting; these days we prefer spec.after(pom -> assertThat(pom).....your_assertions....actual())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssertJ has quite some nice ways to assert what we're after without then having to recreate a text block, by using that actual().

Copy link
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recipe approved already; test assertions could use some polish.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready to Review

Development

Successfully merging this pull request may close these issues.

2 participants