Skip to content

Commit f7bcdc4

Browse files
committed
Show the Maven plugin first in the Quick start
The home page's Quick start now opens with a Maven build, ahead of Gradle. It uses the pom.xml snippet of the Maven plugin page, with the plugin and formatter versions from zensical.toml, and a short note on the phase the plugin runs in, the dependency it cannot run without, Java 21, and where the check goal for CI is described.
1 parent 6e3da26 commit f7bcdc4

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎docs/index.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,39 @@ chain breaks into one call per line.
9292

9393
## Quick start
9494

95+
### In a Maven build
96+
97+
``` xml title="pom.xml"
98+
<build>
99+
<plugins>
100+
<plugin>
101+
<groupId>dev.openjavaformat</groupId>
102+
<artifactId>fmt-maven-plugin</artifactId>
103+
<version>{{ maven_plugin_version }}</version>
104+
<executions>
105+
<execution>
106+
<goals>
107+
<goal>format</goal>
108+
</goals>
109+
</execution>
110+
</executions>
111+
<dependencies>
112+
<dependency>
113+
<groupId>dev.openjavaformat</groupId>
114+
<artifactId>open-java-format</artifactId>
115+
<version>{{ ojf_version }}</version>
116+
</dependency>
117+
</dependencies>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
```
122+
123+
The `format` goal formats `src/main/java` and `src/test/java` in the `process-sources` phase, so the
124+
build formats the sources before it compiles them. The dependency picks the formatter version, and
125+
the plugin does not run without it. Maven has to run on Java 21 or later. The `check` goal for CI is
126+
on the [Maven plugin](get-started/maven.md) page.
127+
95128
### In a Gradle build
96129

97130
=== "Groovy"

0 commit comments

Comments
 (0)