Skip to content

Commit cb9fe74

Browse files
Add spotless maven plugin
* with rules that more or less match current style
1 parent 04205c4 commit cb9fe74

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.github/workflows/maven.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: Java CI
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
410

511
jobs:
612
build:
713
runs-on: ubuntu-latest
814
strategy:
915
matrix:
10-
java: [ 8, 11, 17, 21 ]
16+
java: [ 8, 11 ]
1117
name: Java ${{ matrix.java }} build
1218
steps:
1319
- uses: actions/checkout@v4
@@ -26,5 +32,8 @@ jobs:
2632
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
2733
restore-keys: ${{ runner.os }}-m2
2834
- name: Build with Maven
29-
run: ./mvnw clean install -Dgpg.skip
35+
run: ./mvnw clean package -Dgpg.skip
36+
- if: ${{ matrix.java != 8 }}
37+
name: Check style with Spotless
38+
run: ./mvnw spotless:check
3039

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<wire.version>3.7.1</wire.version>
7474
<wire.plugin.version>3.0.2</wire.plugin.version>
7575
<wire.suffix></wire.suffix>
76+
<spotless.version>2.41.1</spotless.version>
7677
</properties>
7778

7879
<dependencyManagement>
@@ -266,6 +267,25 @@
266267
</execution>
267268
</executions>
268269
</plugin>
270+
<plugin>
271+
<groupId>com.diffplug.spotless</groupId>
272+
<artifactId>spotless-maven-plugin</artifactId>
273+
<version>${spotless.version}</version>
274+
<configuration>
275+
<java>
276+
<excludes>
277+
<exclude>**/_*.java</exclude>
278+
</excludes>
279+
<googleJavaFormat>
280+
<version>1.19.1</version>
281+
<style>AOSP</style>
282+
<reflowLongStrings>true</reflowLongStrings>
283+
<formatJavadoc>false</formatJavadoc>
284+
</googleJavaFormat>
285+
<removeUnusedImports />
286+
</java>
287+
</configuration>
288+
</plugin>
269289
</plugins>
270290
</build>
271291

0 commit comments

Comments
 (0)