Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HasMavenAncestry recipe #4529

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DidierLoiseau
Copy link
Contributor

@DidierLoiseau DidierLoiseau commented Sep 26, 2024

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 when version 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

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant