Uploaded image for project: 'WINDUPRULE - Red Hat Application Migration Toolkit rules'
  1. WINDUPRULE - Red Hat Application Migration Toolkit rules
  2. WINDUPRULE-1046

Package OpenRewrite recipes in a jar for discovery

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • False
    • None
    • False

      -

      Proposed title of this feature request
      Package OpenRewrite recipes in a jar for discovery

      What is the nature and description of the request?
      Currently invoking OpenRewrite recipes looks like this:

      bin/windup-cli --openrewrite     --input `pwd`/../ticket2rock    -Drewrite.configLocation=`pwd`/rules/openrewrite/jakarta/javax/imports/rewrite.yml     -DactiveRecipes=org.jboss.windup.JavaxToJakarta  --goal run

      The user needs to know the name of the recipe and the location of the recipe. The windup-cli invoke mvn like this:

      mvn org.openrewrite.maven:rewrite-maven-plugin:4.25.0:run -Drewrite.configLocation=/Users/esiegl/Documents/Develop/windup-cli-6.2.1.Final/rules/openrewrite/jakarta/javax/imports/rewrite.yml -DactiveRecipes=org.jboss.windup.JavaxToJakarta

      This feature request proposes to package the recipes in a way such that OpenRewrite discovers the recipe similar to the Quarkus project in https://github.com/quarkusio/quarkus-updates/ . The recipes then could be called like this:

      mvn -U org.openrewrite.maven:rewrite-maven-plugin:run  -Drewrite.recipeArtifactCoordinates=org.jboss.windup.rules:windup-rulesets:6.4.0-SNAPSHOT  -Drewrite.activeRecipes=org.jboss.windup.JavaxToJakarta

      without specifying a location for rewrite.yml, even without downloading a Windup distibution

      It also makes discovery of the recipes simple with 

      mvn org.openrewrite.maven:rewrite-maven-plugin:discover   -Drewrite.recipeArtifactCoordinates=org.jboss.windup.rules:windup-rulesets:6.4.0-SNAPSHOT

      ...

      {}[*INFO*] -{} rewrite:5.20.0:discover (default-cli) @ standalone-pom -[*INFO*] Available Recipes:[*INFO*]     org.jboss.windup.eap8.FacesWebXml[*INFO*]     org.jboss.windup.jakarta.javax.BootstrappingFiles[*INFO*]     org.jboss.windup.jakarta.javax.PersistenceXml[*INFO*]     org.jboss.windup.JavaxActivationToJakartaActivation[*INFO*]     org.jboss.windup.JavaxAnnotationToJakartaAnnotation[*INFO*]     org.jboss.windup.JavaxBatchToJakartaBatch[*INFO*]     org.jboss.windup.JavaxDecoratorToJakartaDecorator[*INFO*]     org.jboss.windup.JavaxEjbToJakartaEjb[*INFO*]     org.jboss.windup.JavaxElToJakartaEl[*INFO*]     org.jboss.windup.JavaxEnterpriseToJakartaEnterprise

      ...

       

      Why does the customer need this? (List the business requirements here)

      For larger projects specifying a single recipe is not enough for a migration. You may need to combine standard recipes with project specific custom recipes. For these customizations a rewrite.yml in the project directory is used and it would be convenient to configure OpenRewrite in the pom.xml like this:

      {{            <plugin>
                      <groupId>org.openrewrite.maven</groupId>
                      <artifactId>rewrite-maven-plugin</artifactId>
                      <version>5.17.1</version>
                      <dependencies>
                          <dependency>
                              <groupId>org.openrewrite.recipe</groupId>
                              <artifactId>rewrite-migrate-java</artifactId>
                              <version>2.5.0</version>
                          </dependency>
                          <dependency>
                              <groupId>org.openrewrite.recipe</groupId>
                              <artifactId>rewrite-testing-frameworks</artifactId>
                              <version>2.1.5</version>
                          </dependency>
                          <dependency>
                              <groupId>org.jboss.windup.rules</groupId>
                              <artifactId>windup-rulesets</artifactId>
                              <version>6.4.0-SNAPSHOT</version>
                          </dependency>
                      </dependencies>
                  </plugin>
      }}

      Currently this seems to be not possible since the location for rewrite.yml is occupied by Windup and the recipes are not packaged to be discovered by the OpenRewrite plugin.

      Optional: List affected component/s.

            Unassigned Unassigned
            erhard.siegl@gepardec.com Erhard Siegl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: