• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 26 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OpenRewrite's Maven plugin.

Logo

Eliminate Tech-Debt. At build time.

ci Apache 2.0 Maven Central Contributing Guide

What is this?

This project provides a Maven 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.

Getting started

This README may not have the most up-to-date documentation. For the most up-to-date documentation and reference guides, see:

To configure, add the plugin to your POM:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version><!-- latest version here --></version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.format.AutoFormat</recipe>
                    </activeRecipes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

If wanting to leverage recipes from other dependencies:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version><!-- latest version here --></version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.testing.junit5.JUnit5BestPractices</recipe>
                        <recipe>org.openrewrite.github.ActionsSetupJavaAdoptOpenJDKToTemurin</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-testing-frameworks</artifactId>
                        <version><!-- latest dependency version here --></version>
                    </dependency>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-github-actions</artifactId>
                        <version><!-- latest dependency version here --></version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

To get started, try mvn rewrite:help, mvn rewrite:discover, mvn rewrite:dryRun, mvn rewrite:run, among other plugin goals.

See the Maven Plugin Configuration documentation for full configuration and usage options.

Snapshots

To use the latest -SNAPSHOT version, add a <pluginRepositories> entry for OSSRH snapshots. For example:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <!-- Use whichever version is latest at the time of reading. This number is a placeholder. -->
                <version>4.17.0-SNAPSHOT</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.logging.slf4j.Log4j2ToSlf4j</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-testing-frameworks</artifactId>
                        <!-- Use whichever version is latest at the time of reading. This number is a placeholder. -->
                        <version>1.1.0-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <pluginRepositories>
        <pluginRepository>
            <id>ossrh-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </pluginRepository>
    </pluginRepositories>

</project>

Notes for developing and testing this plugin

This plugin uses the Maven Integration Testing Framework Extension for tests.

All tests can be run from the command line using:

./mvnw verify

If you're looking for more information on the output from a test, try checking the target/maven-it/**/*IT/** directory contents after running the tests. It will contain the project state output, including maven logs, etc. Check the Integration Testing Framework Users Guide for information, too. It's good.

Contributing

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

Resource guides

More Repositories

1

rewrite

Automated mass refactoring of source code.
Java
2,194
star
2

rewrite-spring

OpenRewrite recipes for Spring projects.
Java
256
star
3

rewrite-migrate-java

OpenRewrite recipes for migrating to newer versions of Java.
Java
103
star
4

rewrite-testing-frameworks

OpenRewrite recipes that perform common Java testing migration tasks.
Java
76
star
5

rewrite-gradle-plugin

OpenRewrite's Gradle plugin.
Java
63
star
6

rewrite-kotlin

Work-in-progress implementation of Kotlin language support for OpenRewrite.
Java
46
star
7

rewrite-docs

Stores the markdown documents used to generate docs.openrewrite.org
TypeScript
41
star
8

rewrite-static-analysis

OpenRewrite recipes for identifying and fixing static analysis issues.
Java
31
star
9

rewrite-logging-frameworks

OpenRewrite recipes for assisting with Java logging migration tasks.
Java
25
star
10

rewrite-java-security

OpenRewrite recipes for patching Java security vulnerabilities.
Java
20
star
11

rewrite-python

OpenRewrite recipes for Python.
Python
17
star
12

rewrite-templating

Automated templating using code snippets.
Java
16
star
13

rewrite-terraform

OpenRewrite recipes for Terraform.
Java
15
star
14

rewrite-javascript

OpenRewrite recipes for JavaScript projects.
JavaScript
14
star
15

rewrite-micronaut

OpenRewrite recipes for Micronaut.
Java
13
star
16

rewrite-java-dependencies

OpenRewrite recipes for managing Java dependencies.
Java
12
star
17

rewrite-quarkus

OpenRewrite recipes for Quarkus.
Java
10
star
18

rewrite-generative-ai

OpenRewrite recipes using generative AI.
Java
10
star
19

rewrite-kubernetes

OpenRewrite recipes for Kubernetes.
Java
9
star
20

rewrite-github-actions

OpenRewrite recipes for performing GitHub action hygiene and migration tasks.
Java
9
star
21

rewrite-recipe-bom

Align version numbers for all OpenRewrite maintained recipe modules
9
star
22

rewrite-jenkins

OpenRewrite recipes to continuously modernize Jenkins plugins.
Java
9
star
23

rewrite-analysis

OpenRewrite recipes for data flow analysis.
Java
7
star
24

rewrite-sql

OpenRewrite recipes for SQL.
Java
7
star
25

rewrite-jhipster

OpenRewrite recipes for JHipster web applications.
Java
7
star
26

rewrite-checkstyle

Eliminate Checkstyle issues. Automatically.
Java
5
star
27

rewrite-hibernate

OpenRewrite recipes for Hibernate ORM.
Java
5
star
28

rewrite-all

Gathers recipes which depend on recipes from many other OpenRewrite-maintained recipe modules
Java
5
star
29

rewrite-build-gradle-plugin

Common build logic for building OpenRewrite and recipe jars.
Java
4
star
30

rewrite-java-8

Java 8 parser for the Rewrite Java language binding.
Java
4
star
31

rewrite-cucumber-jvm

OpenRewrite recipes for CucumberJVM.
Java
4
star
32

rewrite-okhttp

OpenRewrite recipes for OkHttp.
Java
3
star
33

rewrite-circleci

OpenRewrite recipes for CircleCI.
Java
3
star
34

rewrite-recommendations

A collection of recommended OpenRewrite recipes.
3
star
35

rewrite-gradle-tooling-model

A model for extracting semantic information out of Gradle build files necessary for refactoring them.
Java
3
star
36

rewrite-feature-flags

OpenRewrite recipes for LaunchDarkly.
Java
3
star
37

rewrite-openapi

OpenRewrite recipes for OpenAPI.
Java
3
star
38

rewrite-gradle

Migrate Gradle. Automatically.
Kotlin
2
star
39

rewrite-template-generator

Generates parser stubs for usage with JavaTemplate.
Java
2
star
40

rewrite-codemods

rewrite running Javascript codemods
Java
2
star
41

rewrite-docker

Java
2
star
42

rewrite-testcontainers

OpenRewrite recipes for testing containers.
Kotlin
2
star
43

rewrite-sandbox

Java
2
star
44

rules_rewrite

Bazel rules for OpenRewrite. Experimental. Don't try to use these yet unless you're helping to develop them.
2
star
45

rewrite-recipe-markdown-generator

Utility that generates OpenRewrite recipe documentation in markdown format for all recipes on the classpath.
Kotlin
2
star
46

rewrite-concourse

OpenRewrite recipes for Concourse.
Java
2
star
47

rewrite-cloud-suitability-analyzer

OpenRewrite recipes that find similar patterns as https://github.com/vmware-tanzu/cloud-suitability-analyzer, but with type awareness.
Java
2
star
48

rewrite-jackson

OpenRewrite recipes for Jackson.
Java
2
star
49

rewrite-apache

OpenRewrite recipes for Apache projects.
Java
2
star
50

rewrite-nodejs

Java
2
star
51

rewrite-ai-search

Interactions with language models to perform search and impact analysis.
Java
2
star
52

rewrite-houston-jug

Content for Houston Java User Group on July 27
Java
1
star
53

jgit

Forked from eclipse jgit
Java
1
star
54

rewrite-csharp

OpenRewrite CSharp runtime and LST models
C#
1
star
55

rewrite-android

OpenRewrite recipes for Android
Java
1
star
56

rewrite-java-annotproc

Run Rewrite recipes as an annotation processor.
Java
1
star
57

rewrite-roadmap

1
star
58

collaboration-proposals

Propose OpenRewrite collaborations to for instance cover additional libraries and frameworks
1
star
59

gh-automation

Shared GitHub Actions workflows which are used by multiple repositories under the OpenRewrite GitHub organization.
1
star
60

rewrite-migrate-python

OpenRewrite recipes for migrating to newer versions of Python.
Java
1
star
61

rewrite-cobol

COBOL support for OpenRewrite. Open source but not free for commercial use.
COBOL
1
star
62

rewrite-third-party

OpenRewrite recipes maintained by third parties.
Java
1
star
63

rewrite-ruby

Ruby language implementation
Java
1
star
64

rewrite-micrometer

OpenRewrite recipes for Micrometer.
Java
1
star