Skip to content

Repository files navigation

OpenRewrite Logo

rewrite-gradle-plugin

ci Revved up by Develocity Contributing Guide

What is this?

This project provides a Gradle plugin that applies Rewrite checking and fixing tasks as build tasks, one of several possible workflows for propagating change across an organization's source code.

plugins {
    id("java")
    id("org.openrewrite.rewrite").version("latest_version_here")
}

rewrite {
    // Reformats Java Code
    activeRecipe("org.openrewrite.java.format.AutoFormat")
}

Consuming from the Code Genome Project

The plugin is published to the Code Genome Project rather than the Gradle Plugin Portal, since it resolves org.openrewrite artifacts that are only available there. To consume a release or -SNAPSHOT of the rewrite-gradle-plugin, update your project's settings.gradle.kts:

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == "org.openrewrite") {
                useModule("org.openrewrite:plugin:${requested.version}")
            }
        }
    }

    repositories {
        // ...
        maven {
            url = uri("https://artifacts.codegenomeproject.org/maven")
            credentials {
                username = "USERNAME"
                password = "TOKEN"
            }
        }
        // ...
        // you'll likely also need this if you don't have a pluginManagement section already:
        gradlePluginPortal()
        // ...
    }
}

The Code Genome Project repository requires authentication. Sign in to get a download token, then replace USERNAME with the email or username you signed in with and TOKEN with that token.

The plugin can be consumed in your build.gradle.kts:

plugins {
    id("org.openrewrite.rewrite") version "X.Y.Z"
    // or resolved dynamically to the absolute latest snapshot:
    id("org.openrewrite.rewrite") version "latest.integration"
}

Contributing

We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.

Documentation

About

OpenRewrite's Gradle plugin.

Topics

Resources

Contributing

Stars

88 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages