My requirement is to modify Junit test cases manually after running OpenRewrite recipe command. Can we can run with dryRun
or run
maven commands with something like -Dmaven.test.skip=true
?
I tried below command:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE \
-Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1 -Dmaven.test.skip=true
but its also applied change for my project Junit test cases.
Had you looked at using exclusions when running OpenRewrite? That might help you prevent changes to certain files.
Alternatively you can let OpenRewrite run and revert any unwanted changes through git.
That being said, it seems like a very strange requirement to have to modify JUnit test cases, manually, and I do not understand why you would want or need to do that. Can you elaborate on that?
You might be able to run OpenRewrite twice (or more); once only applying changes to src/main
, and then again only applying changes to src/test
. There's also some lower granularity recipes that together make up UpgradeSpringBoot_3_1
, some of which only affect tests. You could create a subset of recipes to run through a rewrite.yml
file.