Move documentation examples off source-available recipes - #539
Conversation
Step 6 of the quickstart and the Maven "without modifying the build" guide taught SpringBoot2JUnit4to5Migration and JavaxMigrationToJakarta, which ship in rewrite-spring and rewrite-migrate-java under the Moderne Source Available License. Both now use the Jackson 2.x to 3.x migration from rewrite-jackson, which is Apache-licensed and stays Apache through its entire recipe list. The Step 6 preamble also claimed the Mockito, JUnit and AssertJ recipes live in rewrite-spring. They live in rewrite-testing-frameworks.
styles.md, yaml-format-reference.md and gradle-plugin-configuration.md illustrated their examples with CommonStaticAnalysis and JUnit5BestPractices, which ship in rewrite-static-analysis and rewrite-testing-frameworks under the Moderne Source Available License. In each case the recipe was incidental to the lesson, so they now use Apache-licensed recipes: the Jackson 2.x to 3.x migration in styles.md and gradle-plugin-configuration.md, and RemoveUnusedImports in the precondition example in yaml-format-reference.md. The three tabs in the "Using styles" section showed three different examples, two of which activated a recipe without putting it on the classpath, and the command-line tab referenced a style the page never defines. All three now use the same recipe, artifact and style.
customize-recipe.md walks through the Moderne recipe builder using CommonStaticAnalysis, UpgradeSpringBoot_3_3 and SpringBoot2JUnit4to5Migration, which ship under the Moderne Source Available License. Six of the page's ten screenshots show those recipes by name, so swapping them needs new captures rather than a text edit. The page carries an MsalNotice instead. MsalNotice accepted a single module and this page draws on three, so it now takes an array as well and names each one in a single sentence. The single-string form is unchanged, and the thirteen pages already using it render exactly as before.
mike-solomon
left a comment
There was a problem hiding this comment.
Approving - but there is one thing we need to fix prior to merging this in.
| ``` | ||
|
|
||
| To double-check that everything is working, run the command `mvn rewrite:run`. Your project should be upgraded to Spring Boot 2 and all of the test classes should be updated to JUnit 5. Your `pom.xml` file will also have had its Spring dependencies updated, the JUnit 4 dependency removed, and the JUnit 5 dependency added. | ||
| To double-check that everything is working, run the command `mvn rewrite:run`. Your project's Jackson imports and API usages should be migrated from 2.x to 3.x. Your `pom.xml` file will also have had its Jackson dependencies updated to the 3.x coordinates. |
There was a problem hiding this comment.
The spring petclinic project that we are using as an example here does not have Jackson in it. If someone ran the stuff being suggested in this guide, they won't actually see any of the changes we're claiming they will see.
We need to do one of these:
- Pick a new recipe that makes sense for the project OR
- Point to a different sample repository other than spring petclinic OR
- Update the documentation to be clearer that they need to run this against their own repo that has Jackson or whatnot
I feel like it would be best to make it so someone could go through this guide and see the changes in a repo we've given them. I can't find any recipe that would work well here, though. Maybe that's something you can help with?
There was a problem hiding this comment.
Good catch! How do you feel about adding a Jackson using class to the openrewrite/spring-petclinic-migration used in this guide?
We own this project anyway.
There was a problem hiding this comment.
Good idea! Fine by me.
There was a problem hiding this comment.
I'll go head and add one
There was a problem hiding this comment.
Confirmed — nothing in the sample used Jackson, so the recipe ran and changed nothing.
Added it to the sample instead: openrewrite/spring-petclinic-migration#8. With that in place, Step 6 rewrites eleven things across VetSerializer.java and pom.xml.
Six documentation pages taught recipes that ship under the Moderne Source Available License. Five now use Apache-licensed recipes; the sixth carries a notice, because its examples are baked into screenshots.
Onboarding guides
running-recipes/getting-started.mdStep 6 usedorg.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migrationfromrewrite-springrunning-recipes/running-rewrite-on-a-maven-project-without-modifying-the-build.mdusedorg.openrewrite.java.migrate.jakarta.JavaxMigrationToJakartafromrewrite-migrate-javaBoth now use
org.openrewrite.java.jackson.UpgradeJackson_2_3fromorg.openrewrite.recipe:rewrite-jackson. It fits the same slot — a well-known library migration living in an external artifact you have to add as a dependency, with no options to configure — and it is Apache-licensed through its entire recipe list, not just at the top. That last part matters:rewrite-micronautandrewrite-quarkusare Apache too, but the Micronaut composites reachrewrite-migrate-javaone hop down, so picking on the surface license alone would have moved the problem rather than fixed it.Reusing the same recipe on both pages is deliberate. A reader arriving at the Maven page from the quickstart already knows what the recipe does, so the page teaches only the thing that differs: invoking an external-module recipe from the command line instead of the build file.
Two things came along with the swap. The outcome prose on both pages described changes the old recipes made ("your project should be upgraded to Spring Boot 2 and the JUnit 4 dependency removed") and would have been wrong left as-is. And the Step 6 preamble claimed the Mockito, JUnit and AssertJ recipes live in
rewrite-spring— they live inrewrite-testing-frameworks, which was already wrong before this change.Styles and reference pages
concepts-and-explanations/styles.mdandreference/gradle-plugin-configuration.md→ the same Jackson migrationreference/yaml-format-reference.md→org.openrewrite.java.RemoveUnusedImportsin the precondition example, which also renames the example recipe and updates the two prose references to itstyles.mdneeded more than a substitution. Its "Using styles" section had three tabs showing three different examples: the Gradle tab activatedsomeRecipe, the Maven tab had<!-- Recipes here -->, and neither put a recipe on the classpath, so neither snippet would run. The command-line tab referencedorg.some.style.name, a style defined nowhere on the page. All three now activate the same recipe from the same artifact with the same style —com.yourorg.YesTabsNoStarImports, the one the page defines earlier — so the page can be read top to bottom on one example.A migration was chosen over
AutoFormatdeliberately. Styles govern how recipes format the code they write; demonstrating that with a formatter shows only reformatting, and argues OpenRewrite down to a formatter.AutoFormatstill appears further down in "Reformatting your code", where it belongs.The page that cannot move
running-recipes/customize-recipe.mdwalks through the Moderne recipe builder, and six of its ten screenshots showCommonStaticAnalysis,MultipleVariableDeclarationsand the Spring Boot 3.3 tree by name. Swapping the text without redoing the captures would leave the walkthrough contradicting its own images, so the page gets an<MsalNotice>instead. Tracked on our internal tracker asmoderneinc/customer-requests#3095.That page draws on three source-available modules and
MsalNoticetook one, so it now accepts an array as well. The single-string form is untouched, and the thirteen pages already using it render exactly as before.What this does not change
None of this removes the Code Genome Project credential requirement. Every page here already states that all OpenRewrite releases, the Maven and Gradle plugins included, are published there and need authentication. What changes is that the recipes being taught are Apache-licensed, so five of the six pages need no notice at all.
yarn buildpasses with no warnings and no broken links.