-
Notifications
You must be signed in to change notification settings - Fork 77
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
Pass in single recipe configuration options on the command line #816
Conversation
Thanks for getting this started! Would you happen to have an example of how the non-flat Map is assigned from the command line? I'm wondering how to test this properly. We'll likely start with incubating this, and potentially have to limit it to non-composite recipes, as larger composites can contain a single recipe multiple times, and not all recipes might have the same options. Right now it seems like we might set the same argument on all recipes? |
From command line it wouldn't be possible, as maven don't parse complex types from command line. Those can only be set as maven configuration on pom file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see this kicked off ; I've added two comments that I think we should address before a merge, but I'm also interested to hear your thoughts. Mostly I want to add this in such a way that we promote good practices, and not enable anti-patterns too much.
src/main/java/org/openrewrite/maven/AbstractRewriteBaseRunMojo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/maven/AbstractRewriteBaseRunMojo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone ahead and applied the changes I suggested earlier @velo ; Hope you agree with the final form. I'll likely merge this tomorrow morning unless any blocking feedback comes in.
src/main/java/org/openrewrite/maven/AbstractRewriteBaseRunMojo.java
Outdated
Show resolved
Hide resolved
This now works. mvn org.openrewrite.maven:rewrite-maven-plugin:5.36.0-SNAPSHOT:run -Drewrite.activeRecipes=org.openrewrite.maven.RemovePlugin -Drewrite.options=groupId=org.springframework.boot,artifactId=spring-boot-maven-plugin When run against the spring-petclinic it correctly removes only the argument plugin; Thanks to all involved! |
This is awesome... I'm still shocked that maven can parse lists but can't maps |
src/main/java/org/openrewrite/maven/AbstractRewriteBaseRunMojo.java
Outdated
Show resolved
Hide resolved
* Do not wrap single active recipe & remove `activateAll()` As discovered on openrewrite/rewrite-maven-plugin#816 * Add missing recipe descriptions * Do not expect CompositeRecipe wrapper in data table row * Return Recipe.noop() when there are no activated recipes * Add missing test descriptions * Further test fixes
Thanks again @velo ! Hope this helps folks to do quick one-off configurable recipe runs. |
Use like this: