Skip to content

Commit eff05b1

Browse files
committed
Fail formatting check before tests execute
By default, the spotless Maven plugin binds its check goal to the verify phase (late in the lifecycle, after integration tests). Because we currently only run `mvn test` for CI, it doesn't proceed as far as verify so missed formatting is not caught by CI. This binds the check to an earlier phase, in between test-compile and test, so that it will fail before `mvn test` but not disrupt your dev workflow of compiling main and test sources as you work. This strikes a good compromise on failing fast for code standards without being _too_ nagging. For the complete lifecycle reference, see: https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
1 parent be47510 commit eff05b1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@
350350
<removeUnusedImports />
351351
</java>
352352
</configuration>
353+
<executions>
354+
<!-- Move check to fail faster, but after compilation. Default is verify phase -->
355+
<execution>
356+
<id>spotless-check</id>
357+
<phase>process-test-classes</phase>
358+
<goals>
359+
<goal>check</goal>
360+
</goals>
361+
</execution>
362+
</executions>
353363
</plugin>
354364
<plugin>
355365
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)