Skip to content

Commit fc1f235

Browse files
committed
Show the Maven plugin in the README
dev.openjavaformat:fmt-maven-plugin 2.27.0.1 is on Maven Central, released from openjavaformat/fmt-maven-plugin, and openjavaformat.dev has a Get started page for it. The README now names it among the Maven Central artifacts, links that page, and shows the plugin block a pom.xml needs. The block names the open-java-format version as well, because the plugin brings no formatter of its own and a build without the dependency stops. The snippet was run against the published 2.27.0.1 with 2.98.0.4.
1 parent b853b9f commit fc1f235

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ and published from this repository.
2020

2121
| Where | What |
2222
|---|---|
23-
| [Maven Central](https://central.sonatype.com/namespace/dev.openjavaformat) | `dev.openjavaformat:open-java-format`, with `-spi`, `-native` and `-jdk-bootstrap` |
23+
| [Maven Central](https://central.sonatype.com/namespace/dev.openjavaformat) | `dev.openjavaformat:open-java-format`, with `-spi`, `-native` and `-jdk-bootstrap`, and the Maven plugin `dev.openjavaformat:fmt-maven-plugin` from [its own repository](https://github.com/openjavaformat/fmt-maven-plugin) |
2424
| [Gradle Plugin Portal](https://plugins.gradle.org/plugin/dev.openjavaformat.java-format) | `dev.openjavaformat.java-format` |
2525
| [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/34359-open-java-format) | the IntelliJ IDEA plugin |
2626
| [GitHub Releases](https://github.com/openjavaformat/open-java-format/releases/latest) | native binaries, a runnable jar, the Gradle, IntelliJ and Eclipse plugins, every file signed |
@@ -32,11 +32,39 @@ Why the project exists is in the [manifesto](https://openjavaformat.dev/manifest
3232
Each page is short and every command on it was run against the published artifacts.
3333

3434
- [Gradle plugin](https://openjavaformat.dev/get-started/gradle/)
35+
- [Maven plugin](https://openjavaformat.dev/get-started/maven/)
3536
- [Command line](https://openjavaformat.dev/get-started/command-line/): a native binary, or a runnable jar
3637
- [IntelliJ IDEA](https://openjavaformat.dev/get-started/intellij-idea/)
3738
- [Eclipse](https://openjavaformat.dev/get-started/eclipse/)
3839
- [GitHub Action and pre-commit hook](https://openjavaformat.dev/get-started/github-actions/)
3940

41+
With Maven, add the plugin and name the open-java-format version it formats with. The plugin brings
42+
no formatter of its own, so the dependency is required:
43+
44+
```xml
45+
<plugin>
46+
<groupId>dev.openjavaformat</groupId>
47+
<artifactId>fmt-maven-plugin</artifactId>
48+
<version>2.27.0.1</version>
49+
<executions>
50+
<execution>
51+
<goals>
52+
<goal>format</goal>
53+
</goals>
54+
</execution>
55+
</executions>
56+
<dependencies>
57+
<dependency>
58+
<groupId>dev.openjavaformat</groupId>
59+
<artifactId>open-java-format</artifactId>
60+
<version>2.98.0.4</version>
61+
</dependency>
62+
</dependencies>
63+
</plugin>
64+
```
65+
66+
`format` rewrites the sources before they are compiled; the `check` goal fails the build instead.
67+
4068
## What the output looks like
4169

4270
Lines are up to 120 characters wide. A lambda stays on the line where it starts, and a long call

0 commit comments

Comments
 (0)