Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed?
Provides a recipe to check if a pom file has a specific artifact as ancestry – to be used as a precondition for other recipes.
What's your motivation?
We needed to check the parent before performing some cleanup. Might as well contribute this generic recipe 😏
This could also be used to conditionally perform some upgrades, e.g. only perform Spring Boot 3 migration if we are not already in Spring Boot 3 (see also openrewrite/rewrite-spring#361) – although you would also need to check the imported poms in this case.
Anything in particular you'd like reviewers to focus on?
I also took the opportunity to document
Semver.validate()
, although the documentation is mostly copied from existing recipes and may need some clarification.The recipe does not support a
versionPattern
– I’m not sure how to handle it whenversion
isn’t provided, which could be useful for example if someone wanted to check if any ancestry is a snapshot or release candidate.Have you considered any alternatives or workarounds?
There does not seem to be many recipes to use as predicates on pom files…
Checklist