Skip to content

Commit e299159

Browse files
author
Vincent Potucek
committed
PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin
1 parent a5a1ba5 commit e299159

File tree

59 files changed

+451
-1168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+451
-1168
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ updates:
8585
- dependency-name: org.apache.maven.plugins:*
8686
- dependency-name: org.codehaus.mojo:*
8787
- dependency-name: io.fabric8:docker-maven-plugin
88-
- dependency-name: net.revelc.code.formatter:formatter-maven-plugin
89-
- dependency-name: net.revelc.code:impsort-maven-plugin
88+
- dependency-name: com.diffplug.spotless:spotless-maven-plugin
9089
# Narayana
9190
- dependency-name: org.jboss.narayana.jta:*
9291
- dependency-name: org.jboss.narayana.jts:*

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/agroal/runtime/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@
9494
<execution>
9595
<phase>process-resources</phase>
9696
<goals>
97-
<goal>extension-descriptor</goal>
97+
<goal>extension-descriptor</goal>
9898
</goals>
9999
<configuration>
100-
<conditionalDevDependencies>
101-
<artifact>${project.groupId}:${project.artifactId}-dev:${project.version}</artifact>
100+
<conditionalDevDependencies>
101+
<artifact>${project.groupId}:${project.artifactId}-dev:${project.version}</artifact>
102102
</conditionalDevDependencies>
103103
</configuration>
104104
</execution>

extensions/amazon-lambda/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
<module>deployment</module>
2424
<module>maven-archetype</module>
2525
</modules>
26-
26+
2727
</project>

extensions/arc/runtime-dev/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<artifactId>quarkus-arc-dev</artifactId>
1313
<name>Quarkus - ArC - Runtime Dev mode</name>
1414
<description>Build time CDI dependency injection - Dev mode only</description>
15-
15+
1616
<dependencies>
1717
<dependency>
1818
<groupId>${project.groupId}</groupId>
1919
<artifactId>quarkus-arc</artifactId>
2020
</dependency>
2121
</dependencies>
22-
22+
2323
</project>

extensions/datasource/common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<dependency>
2525
<groupId>org.jboss.logmanager</groupId>
2626
<artifactId>jboss-logmanager</artifactId>
27-
<scope>test</scope>
27+
<scope>test</scope>
2828
</dependency>
2929
</dependencies>
3030
</project>

extensions/datasource/runtime/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
<execution>
4646
<phase>process-resources</phase>
4747
<goals>
48-
<goal>extension-descriptor</goal>
48+
<goal>extension-descriptor</goal>
4949
</goals>
5050
<configuration>
51-
<conditionalDevDependencies>
52-
<artifact>${project.groupId}:${project.artifactId}-dev:${project.version}</artifact>
51+
<conditionalDevDependencies>
52+
<artifact>${project.groupId}:${project.artifactId}-dev:${project.version}</artifact>
5353
</conditionalDevDependencies>
5454
</configuration>
5555
</execution>

extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
*/
1414
package io.quarkus.kubernetes.spi;
1515

16-
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create;
1716
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.configmap;
1817
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.secret;
1918
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.var;
19+
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create;
2020
import static org.junit.jupiter.api.Assertions.assertEquals;
2121
import static org.junit.jupiter.api.Assertions.assertNull;
2222

extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntity
44
import jakarta.persistence.Id
55

66
class DuplicateIdEntity : PanacheEntity() {
7-
@Id
8-
var customId: String? = null
7+
@Id var customId: String? = null
98
}

extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package io.quarkus.hibernate.orm.panache.kotlin.deployment.test
22

33
import io.quarkus.builder.BuildException
44
import io.quarkus.test.QuarkusUnitTest
5-
import org.jboss.shrinkwrap.api.spec.JavaArchive
65
import org.jboss.shrinkwrap.api.ShrinkWrap
6+
import org.jboss.shrinkwrap.api.spec.JavaArchive
77
import org.junit.jupiter.api.Assertions
88
import org.junit.jupiter.api.Test
99
import org.junit.jupiter.api.extension.RegisterExtension
@@ -17,11 +17,9 @@ class DuplicateIdEntityTest {
1717
companion object {
1818
@RegisterExtension
1919
@JvmField
20-
var runner = QuarkusUnitTest()
21-
.setExpectedException(BuildException::class.java)
22-
.setArchiveProducer {
23-
ShrinkWrap.create(JavaArchive::class.java)
24-
.addClasses(DuplicateIdEntity::class.java)
25-
}
20+
var runner =
21+
QuarkusUnitTest().setExpectedException(BuildException::class.java).setArchiveProducer {
22+
ShrinkWrap.create(JavaArchive::class.java).addClasses(DuplicateIdEntity::class.java)
23+
}
2624
}
2725
}

0 commit comments

Comments
 (0)