Skip to content

Commit 69879fe

Browse files
author
Vincent Potucek
committed
PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin
1 parent 15f6b44 commit 69879fe

File tree

13 files changed

+116
-414
lines changed

13 files changed

+116
-414
lines changed

build-parent/pom.xml

Lines changed: 50 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,48 @@
681681
<groupId>com.diffplug.spotless</groupId>
682682
<artifactId>spotless-maven-plugin</artifactId>
683683
<version>2.44.4</version>
684+
<configuration>
685+
<formats>
686+
<format>
687+
<trimTrailingWhitespace/>
688+
<!-- <endWithNewline/> -->
689+
<indent>
690+
<spaces>true</spaces>
691+
<spacesPerTab>2</spacesPerTab>
692+
</indent>
693+
<includes>
694+
<include>.gitignore</include>
695+
</includes>
696+
<excludes>
697+
<exclude>**gradlew**</exclude>
698+
<exclude>**mvnw**</exclude>
699+
<exclude>extensions/panache/**/pom.xml</exclude>
700+
<exclude>test-framework/junit5/pom.xml</exclude>
701+
<exclude>test-framework/security/pom.xml</exclude>
702+
</excludes>
703+
</format>
704+
</formats>
705+
<java>
706+
<eclipse>
707+
<file>${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse-format.xml</file>
708+
</eclipse>
709+
<importOrder>
710+
<file>${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse.importorder</file>
711+
</importOrder>
712+
<!-- <removeUnusedImports /> -->
713+
<excludes>
714+
<!-- https://github.com/diffplug/spotless/issues/2491 -->
715+
<exclude>**/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientContextResolverHandler.java</exclude>
716+
<exclude>**/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientExceptionMapperHandler.java</exclude>
717+
<exclude>**/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientRedirectHandler.java</exclude>
718+
</excludes>
719+
</java>
720+
<kotlin>
721+
<ktfmt>
722+
<style>KOTLINLANG</style>
723+
</ktfmt>
724+
</kotlin>
725+
</configuration>
684726
</plugin>
685727
</plugins>
686728
</pluginManagement>
@@ -698,28 +740,14 @@
698740
<build>
699741
<plugins>
700742
<plugin>
701-
<groupId>net.revelc.code.formatter</groupId>
702-
<artifactId>formatter-maven-plugin</artifactId>
703-
<executions>
704-
<execution>
705-
<phase>process-sources</phase>
706-
<goals>
707-
<goal>format</goal>
708-
</goals>
709-
</execution>
710-
</executions>
711-
</plugin>
712-
<plugin>
713-
<groupId>net.revelc.code</groupId>
714-
<artifactId>impsort-maven-plugin</artifactId>
715-
<configuration>
716-
<removeUnused>true</removeUnused>
717-
</configuration>
743+
<groupId>com.diffplug.spotless</groupId>
744+
<artifactId>spotless-maven-plugin</artifactId>
718745
<executions>
719746
<execution>
720-
<id>sort-imports</id>
747+
<id>spotless-apply</id>
748+
<phase>verify</phase>
721749
<goals>
722-
<goal>sort</goal>
750+
<goal>apply</goal>
723751
</goals>
724752
</execution>
725753
</executions>
@@ -735,80 +763,20 @@
735763
<name>no-format</name>
736764
</property>
737765
</activation>
738-
<build>
739-
<plugins>
740-
<plugin>
741-
<groupId>net.revelc.code.formatter</groupId>
742-
<artifactId>formatter-maven-plugin</artifactId>
743-
<executions>
744-
<execution>
745-
<phase>process-sources</phase>
746-
<goals>
747-
<goal>validate</goal>
748-
</goals>
749-
</execution>
750-
</executions>
751-
</plugin>
752-
<plugin>
753-
<groupId>net.revelc.code</groupId>
754-
<artifactId>impsort-maven-plugin</artifactId>
755-
<configuration>
756-
<removeUnused>true</removeUnused>
757-
</configuration>
758-
<executions>
759-
<execution>
760-
<id>check-imports</id>
761-
<goals>
762-
<goal>check</goal>
763-
</goals>
764-
</execution>
765-
</executions>
766-
</plugin>
767-
</plugins>
768-
</build>
769-
</profile>
770-
771-
<profile>
772-
<id>format-kotlin</id>
773-
<activation>
774-
<activeByDefault>true</activeByDefault>
775-
<property>
776-
<name>!no-format</name>
777-
</property>
778-
<file>
779-
<exists>src/main/kotlin</exists>
780-
</file>
781-
</activation>
782766
<build>
783767
<plugins>
784768
<plugin>
785769
<groupId>com.diffplug.spotless</groupId>
786770
<artifactId>spotless-maven-plugin</artifactId>
787771
<executions>
788772
<execution>
789-
<id>format-kotlin</id>
790-
<phase>process-sources</phase>
773+
<id>spotless-check</id>
774+
<phase>verify</phase>
791775
<goals>
792-
<goal>apply</goal>
776+
<goal>check</goal>
793777
</goals>
794778
</execution>
795779
</executions>
796-
797-
<configuration>
798-
<kotlin>
799-
<ktfmt>
800-
<style>KOTLINLANG</style>
801-
<!-- optional, other options are DEFAULT, DROPBOX, GOOGLE and KOTLINLANG -->
802-
</ktfmt>
803-
804-
<!--
805-
<ktfmt>
806-
<style>DEFAULT</style> &lt;!&ndash; optional, other options are DEFAULT, DROPBOX, GOOGLE and KOTLINLANG &ndash;&gt;
807-
</ktfmt>
808-
-->
809-
810-
</kotlin>
811-
</configuration>
812780
</plugin>
813781
</plugins>
814782
</build>

extensions/websockets-next/deployment/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@
196196
<properties>
197197
<maven.compiler.target>21</maven.compiler.target>
198198
<maven.compiler.source>21</maven.compiler.source>
199-
<!-- javaparser 3.25.10 used by impsort-maven-plugin does not define the "language level" for 21 -->
200-
<!--maven.compiler.release>21</maven.compiler.release-->
199+
<maven.compiler.release>21</maven.compiler.release>
201200
</properties>
202201
<build>
203202
<plugins>

independent-projects/arc/pom.xml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -327,32 +327,18 @@
327327
<build>
328328
<plugins>
329329
<plugin>
330-
<groupId>net.revelc.code.formatter</groupId>
331-
<artifactId>formatter-maven-plugin</artifactId>
330+
<groupId>com.diffplug.spotless</groupId>
331+
<artifactId>spotless-maven-plugin</artifactId>
332332
<executions>
333333
<execution>
334-
<phase>process-sources</phase>
334+
<id>spotless-apply</id>
335+
<phase>verify</phase>
335336
<goals>
336-
<goal>format</goal>
337+
<goal>apply</goal>
337338
</goals>
338339
</execution>
339340
</executions>
340341
</plugin>
341-
<plugin>
342-
<groupId>net.revelc.code</groupId>
343-
<artifactId>impsort-maven-plugin</artifactId>
344-
<executions>
345-
<execution>
346-
<id>sort-imports</id>
347-
<goals>
348-
<goal>sort</goal>
349-
</goals>
350-
</execution>
351-
</executions>
352-
<configuration>
353-
<removeUnused>true</removeUnused>
354-
</configuration>
355-
</plugin>
356342
</plugins>
357343
</build>
358344
</profile>
@@ -367,26 +353,11 @@
367353
<build>
368354
<plugins>
369355
<plugin>
370-
<groupId>net.revelc.code.formatter</groupId>
371-
<artifactId>formatter-maven-plugin</artifactId>
372-
<executions>
373-
<execution>
374-
<phase>process-sources</phase>
375-
<goals>
376-
<goal>validate</goal>
377-
</goals>
378-
</execution>
379-
</executions>
380-
</plugin>
381-
<plugin>
382-
<groupId>net.revelc.code</groupId>
383-
<artifactId>impsort-maven-plugin</artifactId>
384-
<configuration>
385-
<removeUnused>true</removeUnused>
386-
</configuration>
356+
<groupId>com.diffplug.spotless</groupId>
357+
<artifactId>spotless-maven-plugin</artifactId>
387358
<executions>
388359
<execution>
389-
<id>check-imports</id>
360+
<phase>verify</phase>
390361
<goals>
391362
<goal>check</goal>
392363
</goals>

independent-projects/bootstrap/pom.xml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -239,32 +239,18 @@
239239
<build>
240240
<plugins>
241241
<plugin>
242-
<groupId>net.revelc.code.formatter</groupId>
243-
<artifactId>formatter-maven-plugin</artifactId>
242+
<groupId>com.diffplug.spotless</groupId>
243+
<artifactId>spotless-maven-plugin</artifactId>
244244
<executions>
245245
<execution>
246-
<phase>process-sources</phase>
246+
<id>spotless-apply</id>
247+
<phase>verify</phase>
247248
<goals>
248-
<goal>format</goal>
249+
<goal>apply</goal>
249250
</goals>
250251
</execution>
251252
</executions>
252253
</plugin>
253-
<plugin>
254-
<groupId>net.revelc.code</groupId>
255-
<artifactId>impsort-maven-plugin</artifactId>
256-
<executions>
257-
<execution>
258-
<id>sort-imports</id>
259-
<goals>
260-
<goal>sort</goal>
261-
</goals>
262-
</execution>
263-
</executions>
264-
<configuration>
265-
<removeUnused>true</removeUnused>
266-
</configuration>
267-
</plugin>
268254
</plugins>
269255
</build>
270256
</profile>
@@ -279,26 +265,11 @@
279265
<build>
280266
<plugins>
281267
<plugin>
282-
<groupId>net.revelc.code.formatter</groupId>
283-
<artifactId>formatter-maven-plugin</artifactId>
284-
<executions>
285-
<execution>
286-
<phase>process-sources</phase>
287-
<goals>
288-
<goal>validate</goal>
289-
</goals>
290-
</execution>
291-
</executions>
292-
</plugin>
293-
<plugin>
294-
<groupId>net.revelc.code</groupId>
295-
<artifactId>impsort-maven-plugin</artifactId>
296-
<configuration>
297-
<removeUnused>true</removeUnused>
298-
</configuration>
268+
<groupId>com.diffplug.spotless</groupId>
269+
<artifactId>spotless-maven-plugin</artifactId>
299270
<executions>
300271
<execution>
301-
<id>check-imports</id>
272+
<phase>verify</phase>
302273
<goals>
303274
<goal>check</goal>
304275
</goals>

independent-projects/enforcer-rules/pom.xml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,18 @@
173173
<build>
174174
<plugins>
175175
<plugin>
176-
<groupId>net.revelc.code.formatter</groupId>
177-
<artifactId>formatter-maven-plugin</artifactId>
176+
<groupId>com.diffplug.spotless</groupId>
177+
<artifactId>spotless-maven-plugin</artifactId>
178178
<executions>
179179
<execution>
180-
<phase>process-sources</phase>
180+
<id>spotless-apply</id>
181+
<phase>verify</phase>
181182
<goals>
182-
<goal>format</goal>
183+
<goal>apply</goal>
183184
</goals>
184185
</execution>
185186
</executions>
186187
</plugin>
187-
<plugin>
188-
<groupId>net.revelc.code</groupId>
189-
<artifactId>impsort-maven-plugin</artifactId>
190-
<executions>
191-
<execution>
192-
<id>sort-imports</id>
193-
<goals>
194-
<goal>sort</goal>
195-
</goals>
196-
</execution>
197-
</executions>
198-
<configuration>
199-
<removeUnused>true</removeUnused>
200-
</configuration>
201-
</plugin>
202188
</plugins>
203189
</build>
204190
</profile>
@@ -213,26 +199,11 @@
213199
<build>
214200
<plugins>
215201
<plugin>
216-
<groupId>net.revelc.code.formatter</groupId>
217-
<artifactId>formatter-maven-plugin</artifactId>
218-
<executions>
219-
<execution>
220-
<phase>process-sources</phase>
221-
<goals>
222-
<goal>validate</goal>
223-
</goals>
224-
</execution>
225-
</executions>
226-
</plugin>
227-
<plugin>
228-
<groupId>net.revelc.code</groupId>
229-
<artifactId>impsort-maven-plugin</artifactId>
230-
<configuration>
231-
<removeUnused>true</removeUnused>
232-
</configuration>
202+
<groupId>com.diffplug.spotless</groupId>
203+
<artifactId>spotless-maven-plugin</artifactId>
233204
<executions>
234205
<execution>
235-
<id>check-imports</id>
206+
<phase>verify</phase>
236207
<goals>
237208
<goal>check</goal>
238209
</goals>

0 commit comments

Comments
 (0)