Skip to content

Commit

Permalink
Correctly format code automatically for sources >= 17 (#449)
Browse files Browse the repository at this point in the history
Includes support for formatting MR-JAR layer directories automatically.
  • Loading branch information
dmlloyd authored Dec 1, 2023
1 parent 66f50ae commit 87ae929
Showing 1 changed file with 260 additions and 1 deletion.
261 changes: 260 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<version.failsafe.plugin>3.2.2</version.failsafe.plugin>
<version.smallrye.code.rules.plugin>2</version.smallrye.code.rules.plugin>
<version.formatter.plugin>2.22.0</version.formatter.plugin>
<version.impsort.plugin>1.8.0</version.impsort.plugin>
<version.impsort.plugin>1.9.0</version.impsort.plugin>
<version.jacoco.plugin>0.8.11</version.jacoco.plugin>
<version.smallrye.plugin>1.0.0</version.smallrye.plugin>
<version.buildnumber.plugin>3.2.0</version.buildnumber.plugin>
Expand Down Expand Up @@ -335,6 +335,7 @@
</configuration>
<executions>
<execution>
<id>format-sources</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
Expand Down Expand Up @@ -463,6 +464,37 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<compliance>11</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<compilerCompliance>11</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -493,6 +525,37 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<compliance>17</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<compilerCompliance>17</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -523,6 +586,37 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<compliance>21</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<compilerCompliance>21</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -637,6 +731,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports-java17</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java17</sourceDirectory>
<compliance>17</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources-java17</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java17</sourceDirectory>
<compilerCompliance>17</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -752,6 +879,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports-java18</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java18</sourceDirectory>
<compliance>18</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources-java18</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java18</sourceDirectory>
<compilerCompliance>18</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -869,6 +1029,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports-java19</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java19</sourceDirectory>
<compliance>19</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources-java19</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java19</sourceDirectory>
<compilerCompliance>19</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -988,6 +1181,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports-java20</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java20</sourceDirectory>
<compliance>20</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources-java20</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java20</sourceDirectory>
<compilerCompliance>20</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -1109,6 +1335,39 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports-java21</id>
<goals>
<goal>sort</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java21</sourceDirectory>
<compliance>21</compliance>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format-sources-java21</id>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/java21</sourceDirectory>
<compilerCompliance>21</compilerCompliance>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit 87ae929

Please sign in to comment.