diff --git a/src/main/java/org/openrewrite/maven/RewriteDiscoverMojo.java b/src/main/java/org/openrewrite/maven/RewriteDiscoverMojo.java
index cdb0adf0..28459368 100644
--- a/src/main/java/org/openrewrite/maven/RewriteDiscoverMojo.java
+++ b/src/main/java/org/openrewrite/maven/RewriteDiscoverMojo.java
@@ -28,8 +28,12 @@
import org.openrewrite.maven.ui.RecipeDescriptorTreePrompter;
import org.openrewrite.style.NamedStyles;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
+import java.util.List;
/**
* Generate a report of the available recipes and styles found on the classpath.
@@ -95,26 +99,34 @@ public void execute() throws MojoExecutionException {
}
private void writeDiscovery(Collection availableRecipeDescriptors, Collection activeRecipeDescriptors, Collection availableStyles) {
+ List availableRecipesSorted = new ArrayList<>(availableRecipeDescriptors);
+ availableRecipesSorted.sort(Comparator.comparing(RecipeDescriptor::getName, String.CASE_INSENSITIVE_ORDER));
getLog().info("Available Recipes:");
- for (RecipeDescriptor recipeDescriptor : availableRecipeDescriptors) {
+ for (RecipeDescriptor recipeDescriptor : availableRecipesSorted) {
writeRecipeDescriptor(recipeDescriptor, detail, 0, 1);
}
+ List availableStylesSorted = new ArrayList<>(availableStyles);
+ availableStylesSorted.sort(Comparator.comparing(NamedStyles::getName, String.CASE_INSENSITIVE_ORDER));
getLog().info("");
getLog().info("Available Styles:");
- for (NamedStyles style : availableStyles) {
+ for (NamedStyles style : availableStylesSorted) {
getLog().info(" " + style.getName());
}
+ List activeStylesSorted = new ArrayList<>(getActiveStyles());
+ activeStylesSorted.sort(String.CASE_INSENSITIVE_ORDER);
getLog().info("");
getLog().info("Active Styles:");
- for (String activeStyle : getActiveStyles()) {
+ for (String activeStyle : activeStylesSorted) {
getLog().info(" " + activeStyle);
}
+ List activeRecipesSorted = new ArrayList<>(activeRecipeDescriptors);
+ activeRecipesSorted.sort(Comparator.comparing(RecipeDescriptor::getName, String.CASE_INSENSITIVE_ORDER));
getLog().info("");
getLog().info("Active Recipes:");
- for (RecipeDescriptor recipeDescriptor : activeRecipeDescriptors) {
+ for (RecipeDescriptor recipeDescriptor : activeRecipesSorted) {
writeRecipeDescriptor(recipeDescriptor, detail, 0, 1);
}