An open API service indexing awesome lists of open source software.

https://github.com/openrewrite/rewrite-maven-plugin

OpenRewrite's Maven plugin.
https://github.com/openrewrite/rewrite-maven-plugin

openrewrite

Last synced: 5 months ago
JSON representation

OpenRewrite's Maven plugin.

Awesome Lists containing this project

README

          






OpenRewrite Logo



rewrite-maven-plugin


[![ci](https://github.com/openrewrite/rewrite-maven-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/openrewrite/rewrite-maven-plugin/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/org.openrewrite.maven/rewrite-maven-plugin.svg)](https://mvnrepository.com/artifact/org.openrewrite.maven/rewrite-maven-plugin)
[![Contributing Guide](https://img.shields.io/badge/Contributing-Guide-informational)](https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md)

## What is this?

This project provides a Maven plugin that applies [Rewrite](https://github.com/openrewrite/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:

- [Auto-generated maven plugin documentation](https://openrewrite.github.io/rewrite-maven-plugin/plugin-info.html)
- [Maven Plugin Configuration](https://docs.openrewrite.org/reference/rewrite-maven-plugin)
- [OpenRewrite Quickstart Guide](https://docs.openrewrite.org/running-recipes/getting-started)

To configure, add the plugin to your POM:

```xml

...



org.openrewrite.maven
rewrite-maven-plugin



org.openrewrite.java.format.AutoFormat




```

If wanting to leverage recipes from other dependencies:

```xml

...



org.openrewrite.maven
rewrite-maven-plugin



org.openrewrite.java.testing.junit5.JUnit5BestPractices
org.openrewrite.github.ActionsSetupJavaAdoptOpenJDKToTemurin




org.openrewrite.recipe
rewrite-testing-frameworks



org.openrewrite.recipe
rewrite-github-actions





```

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](https://docs.openrewrite.org/reference/rewrite-maven-plugin) documentation for full configuration and usage options.

### Snapshots

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

```xml

...



org.openrewrite.maven
rewrite-maven-plugin

4.17.0-SNAPSHOT


org.openrewrite.java.logging.slf4j.Log4j2ToSlf4j




org.openrewrite.recipe
rewrite-testing-frameworks

1.1.0-SNAPSHOT






ossrh-snapshots
https://central.sonatype.com/repository/maven-snapshots

```

## Notes for developing and testing this plugin

This plugin uses the [`Maven Integration Testing Framework Extension`](https://github.com/khmarbaise/maven-it-extension) for tests.

All tests can be run from the command line using:

```sh
./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`](https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html) for information, too. It's good.

## Contributing

We appreciate all types of contributions. See the [contributing guide](https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md) for detailed instructions on how to get started.

### Resource guides

- https://blog.soebes.io/posts/2020/08/2020-08-17-itf-part-i/
- https://carlosvin.github.io/posts/creating-custom-maven-plugin/en/#_dependency_injection
- https://developer.okta.com/blog/2019/09/23/tutorial-build-a-maven-plugin
- https://medium.com/swlh/step-by-step-guide-to-developing-a-custom-maven-plugin-b6e3a0e09966