Skip to content

Commit 3e4d968

Browse files
committed
Configure formatting
The format will be automatically applied using the Maven plugins: - formatter-maven-plugin - for sources - impsort-maven-plugin - for imports - xml-format-maven-plugin - for XML files (POM files)
1 parent 2c53ef5 commit 3e4d968

File tree

4 files changed

+97
-5
lines changed

4 files changed

+97
-5
lines changed

.github/workflows/daily.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
git clone https://github.com/quarkusio/quarkus.git && cd quarkus && mvn -B -s .github/mvn-settings.xml clean install -Dquickly
2929
- name: Test in JVM mode
3030
run: |
31-
mvn -fae -V -B -s .github/mvn-settings.xml -fae clean verify
31+
mvn -fae -V -B -s .github/mvn-settings.xml -Dvalidate-format -fae clean verify
3232
- name: Zip Artifacts
3333
run: |
3434
zip -R artifacts-jvm${{ matrix.java }}.zip '*-reports/*'
@@ -63,7 +63,7 @@ jobs:
6363
git clone https://github.com/quarkusio/quarkus.git && cd quarkus && mvn -B -s .github/mvn-settings.xml clean install -Dquickly
6464
- name: Test in Native mode
6565
run: |
66-
mvn -fae -V -B -s .github/mvn-settings.xml -fae clean verify -Dnative \
66+
mvn -fae -V -B -s .github/mvn-settings.xml -Dvalidate-format -fae clean verify -Dnative \
6767
-Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=4g \
6868
-Dquarkus.native.builder-image=quay.io/quarkus/${{ matrix.image }}
6969
- name: Zip Artifacts

.github/workflows/pr.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
git clone https://github.com/quarkusio/quarkus.git && cd quarkus && mvn -B -s .github/mvn-settings.xml clean install -Dquickly
2929
- name: Test in JVM mode
3030
run: |
31-
mvn -fae -V -B -s .github/mvn-settings.xml clean test
31+
mvn -fae -V -B -s .github/mvn-settings.xml -Dvalidate-format clean test
3232
- name: Smoke Test in Native mode
3333
run: |
34-
mvn -V -B -s .github/mvn-settings.xml -fae clean verify -Dnative \
34+
mvn -V -B -s .github/mvn-settings.xml -Dvalidate-format -fae clean verify -Dnative \
3535
-Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=4g \
3636
-Dquarkus.native.builder-image=quay.io/quarkus/${{ matrix.image }} \
3737
-pl '003-quarkus-many-extensions'

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ target/
3232
pom.xml.tag
3333
pom.xml.releaseBackup
3434
pom.xml.versionsBackup
35-
release.properties
35+
release.properties
36+
impsort-maven-cache.properties

pom.xml

+91
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
<apicurio-registry-utils-serde.version>1.3.2.Final</apicurio-registry-utils-serde.version>
5757
<confluent.kafka-avro-serializer.version>6.0.0</confluent.kafka-avro-serializer.version>
5858
<version.quarkiverse.apicurio.registry.client>0.0.2</version.quarkiverse.apicurio.registry.client>
59+
<camel-quarkus-support-retrofit.version>1.7.0</camel-quarkus-support-retrofit.version>
60+
<formatter-maven-plugin.version>2.15.0</formatter-maven-plugin.version>
61+
<impsort-maven-plugin.version>1.6.0</impsort-maven-plugin.version>
62+
<xml-format-maven-plugin>3.1.2</xml-format-maven-plugin>
5963

6064
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
6165
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
@@ -150,6 +154,69 @@
150154
</systemProperties>
151155
</configuration>
152156
</plugin>
157+
<plugin>
158+
<groupId>net.revelc.code.formatter</groupId>
159+
<artifactId>formatter-maven-plugin</artifactId>
160+
<version>${formatter-maven-plugin.version}</version>
161+
<executions>
162+
<execution>
163+
<goals>
164+
<goal>${src.format.goal}</goal>
165+
</goals>
166+
</execution>
167+
</executions>
168+
<dependencies>
169+
<dependency>
170+
<artifactId>quarkus-ide-config</artifactId>
171+
<groupId>io.quarkus</groupId>
172+
<version>${quarkus.platform.version}</version>
173+
</dependency>
174+
</dependencies>
175+
<configuration>
176+
<configFile>eclipse-format.xml</configFile>
177+
<lineEnding>LF</lineEnding>
178+
</configuration>
179+
</plugin>
180+
<plugin>
181+
<groupId>net.revelc.code</groupId>
182+
<artifactId>impsort-maven-plugin</artifactId>
183+
<version>${impsort-maven-plugin.version}</version>
184+
<configuration>
185+
<!-- store outside of target to speed up formatting when mvn clean is used -->
186+
<cachedir>.cache</cachedir>
187+
<groups>java.,javax.,org.,com.</groups>
188+
<staticGroups>*</staticGroups>
189+
<removeUnused>true</removeUnused>
190+
</configuration>
191+
<executions>
192+
<execution>
193+
<goals>
194+
<goal>${src.sort.goal}</goal>
195+
</goals>
196+
</execution>
197+
</executions>
198+
</plugin>
199+
<plugin>
200+
<groupId>au.com.acegi</groupId>
201+
<artifactId>xml-format-maven-plugin</artifactId>
202+
<version>${xml-format-maven-plugin}</version>
203+
<executions>
204+
<execution>
205+
<goals>
206+
<goal>${xml.format.goal}</goal>
207+
</goals>
208+
<configuration>
209+
<indentSize>4</indentSize>
210+
<excludes>
211+
<!-- Exclude files from target folder -->
212+
<exclude>**/target/**/*.xml</exclude>
213+
<!-- Exclude Quarkus main repository -->
214+
<exclude>**/quarkus/**/*.xml</exclude>
215+
</excludes>
216+
</configuration>
217+
</execution>
218+
</executions>
219+
</plugin>
153220
</plugins>
154221
</build>
155222
<profiles>
@@ -197,5 +264,29 @@
197264
<quarkus.package.type>native</quarkus.package.type>
198265
</properties>
199266
</profile>
267+
<profile>
268+
<id>format</id>
269+
<activation>
270+
<activeByDefault>true</activeByDefault>
271+
</activation>
272+
<properties>
273+
<src.format.goal>format</src.format.goal>
274+
<src.sort.goal>sort</src.sort.goal>
275+
<xml.format.goal>xml-format</xml.format.goal>
276+
</properties>
277+
</profile>
278+
<profile>
279+
<id>validate-format</id>
280+
<activation>
281+
<property>
282+
<name>validate-format</name>
283+
</property>
284+
</activation>
285+
<properties>
286+
<src.format.goal>validate</src.format.goal>
287+
<src.sort.goal>check</src.sort.goal>
288+
<xml.format.goal>xml-check</xml.format.goal>
289+
</properties>
290+
</profile>
200291
</profiles>
201292
</project>

0 commit comments

Comments
 (0)