Use rewrite release versions. Workaround for xml-bind.

This commit is contained in:
aboyko
2023-06-14 13:23:48 -04:00
parent 3af4beac80
commit 8c9692fa18
5 changed files with 18 additions and 8 deletions

View File

@@ -188,15 +188,29 @@ public class RewriteRecipeRepository implements ApplicationContextAware {
IndefiniteProgressTask progressTask = server.getProgressService().createIndefiniteProgressTask(UUID.randomUUID().toString(), "Loading Rewrite Recipes", null);
try {
log.info("Loading Rewrite Recipes...");
Recipe xmlbindRecipe = null;
StsEnvironment env = createRewriteEnvironment();
for (Recipe r : env.listRecipes()) {
if (r.getName() != null) {
if ("org.openrewrite.java.migrate.jakarta.JavaxXmlBindMigrationToJakartaXmlBind".equals(r.getName())) {
xmlbindRecipe = r;
}
if (recipes.containsKey(r.getName())) {
log.error("Duplicate ids: '" + r.getName() + "'");
}
recipes.put(r.getName(), r);
}
}
// HACK: add Jakarta XML Bind migration recipe again as there are cases when maven dependency isn't added
if (xmlbindRecipe != null) {
for (String id : recipes.keySet()) {
if (id.startsWith("org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_")) {
Recipe recipe = recipes.get(id);
recipe.getDescriptor().getRecipeList().add(xmlbindRecipe.getDescriptor());
recipe.getRecipeList().add(xmlbindRecipe);
}
}
}
codeActionDescriptors.addAll(env.listCodeActionDescriptors());
log.info("Done loading Rewrite Recipes");
} catch (Throwable t) {