Search code examples
openrewrite

First recipe : helloworld exercise


Working on the new recipe which is the helloworld exercise in the openrewrite docs .Getting an error while running the recipe . Any help will be appreciated .

https://docs.openrewrite.org/authoring-recipes/writing-a-java-refactoring-recipe

rewrite.yml

type: specs.openrewrite.org/v1beta/recipe
name: com.escuela.openrewrite.SayHelloRecipe
recipeList:
  - com.escuela.openrewrite.SayHelloRecipe:
      fullyQualifiedClassName: com.escuela.openrewrite.FooBar

https://github.com/escuelatech/openrewrite/tree/main/firstORRecepie

I have executed the test-class successfully but there was no expected output .


Solution

  • The YAML recipe name needs to be distinct from the recipe in the recipeList. For example:

    type: specs.openrewrite.org/v1beta/recipe
    name: com.escuela.openrewrite.SayHelloFooBar
    recipeList:
      - com.escuela.openrewrite.SayHelloRecipe:
          fullyQualifiedClassName: com.escuela.openrewrite.FooBar
    

    Notice that name is SayHelloFooBar.