Skip to content

A forkable starter for building your own recipes and deploying them on the Moderne SaaS

Notifications You must be signed in to change notification settings

timo-a/rewrite-recipe-starter

 
 

Repository files navigation

Miscellaneous Rewrite Recipes

ci Apache 2.0 Maven Central

This repository collects my custom recipes, primarily ones that add lombok annotations to projects that started without it.
This repository is still young and may e.g. be rebased, the releases on maven central however are immutable.

Getting started

In order to run any of these recipes on your project you need to use either maven or gradle as a build tool. The OpenRewrite Docs are a great start.

Quickstart

Copy what you need from here:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>RELEASE</version>
                <configuration>
                    <activeRecipes>
                        <recipe>io.github.timoa.lombok.ConvertToNoArgsConstructor</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>io.github.timo-a</groupId>
                        <artifactId>rewrite-misc-recipes</artifactId>
                        <version>0.0.6</version><!-- see above for the latest version -->
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

Recipes offered

  • io.github.timoa.lombok.ConvertToNoArgsConstructor (source)
    A recipe that replaces written out constructor wth no arguments with the respective lombok annotation.
  • io.github.timoa.lombok.ConvertGetterMethodToAnnotation (source)
    A recipe that replaces written out getter methods wth no arguments with the respective lombok annotation.

Reference recipes (kept for now)


Todo: clean up the following parts of the original Readme.

Publishing to Artifact Repositories

This project is configured to publish to Moderne's open artifact repository (via the publishing task at the bottom of the build.gradle.kts file). If you want to publish elsewhere, you'll want to update that task. app.moderne.io can draw recipes from the provided repository, as well as from Maven Central.

Note: Running the publish task will not update app.moderne.io, as only Moderne employees can add new recipes. If you want to add your recipe to app.moderne.io, please ask the team in Slack or in Discord.

These other docs might also be useful for you depending on where you want to publish the recipe:

From Github Actions

The .github directory contains a Github action that will push a snapshot on every successful build.

Run the release action to publish a release version of a recipe.

From the command line

To build a snapshot, run ./gradlew snapshot publish to build a snapshot and publish it to Moderne's open artifact repository for inclusion at app.moderne.io.

To build a release, run ./gradlew final publish to tag a release and publish it to Moderne's open artifact repository for inclusion at app.moderne.io.

Applying OpenRewrite recipe development best practices

We maintain a collection of best practices for writing OpenRewrite recipes. You can apply these recommendations to your recipes by running the following command:

./gradlew rewriteRun -Drewrite.activeRecipe=org.openrewrite.recipes.OpenRewriteBestPractices

or

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-recommendations:RELEASE -Drewrite.activeRecipes=org.openrewrite.recipes.OpenRewriteBestPractices

About

A forkable starter for building your own recipes and deploying them on the Moderne SaaS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%