mvn spotless:check

0.0% Savings
0 Commands
0 Tokens saved
2 Tests

Install

tokf install 28f0cb85a67d94adb4bafa4e9719c9d4bb6c2c2d4b1cd610f83f6ef911b5dea2
Safety checks passed

Filter definition

# filters/mvn/spotless.toml — Maven spotless:check / spotless:apply
# Handles: mvn spotless:check, mvn spotless:apply, and ./mvnw variants
# Raw output: 30-80 lines of per-module spotless results
# Filtered (success): "spotless: clean"
# Filtered (failure): per-module violation counts + file list

command = ["mvn spotless:check", "mvn spotless:apply", "mvn clean spotless:check", "mvn clean spotless:apply", "./mvnw spotless:check", "./mvnw spotless:apply", "./mvnw clean spotless:check", "./mvnw clean spotless:apply"]

strip_ansi = true

match_output = [
  { contains = "BUILD SUCCESS", output = "spotless: clean" },
]

skip = [
  "^WARNING:",
  "^\\[WARNING\\]",
  "^\\[INFO\\] Scanning for projects",
  "^\\[INFO\\]\\s*$",
  "^\\[INFO\\] ---",
  "^\\[INFO\\]\\s+from\\s",
  "^\\[INFO\\] Reactor Build Order",
  "^\\[INFO\\] Spotless\\..+ is keeping",
  "^\\[INFO\\] Sorting file",
  "^\\[INFO\\] Pom file is already sorted",
  "^\\[INFO\\] File stored in the index",
  "^\\[INFO\\] Index file does not exist",
  "^\\[INFO\\] BUILD",
  "^\\[INFO\\] Total time",
  "^\\[INFO\\] Finished at",
  "^\\[INFO\\] Reactor Summary",
  "^\\[ERROR\\] To see the full stack trace",
  "^\\[ERROR\\] Re-run Maven",
  "^\\[ERROR\\] For more information",
  "^\\[ERROR\\] \\[Help",
  "^\\[ERROR\\] -> \\[Help",
  "^To see the full stack trace",
  "^Re-run Maven",
  "^For more information",
  "^\\[Help",
  "^-> \\[Help",
  "^Downloading from",
  "^Downloaded from",
  "^\\s*$",
]

# Per-module chunks for failure case
[[chunk]]
split_on = "^\\[INFO\\] Building\\s"
include_split_line = true
collect_as = "modules"

[chunk.extract]
pattern = 'Building\s+(\S+)\s'
as = "module_name"

[[chunk.aggregate]]
pattern = 'The following files had format violations'
count_as = "violation_count"

[[replace]]
pattern = '^\[ERROR\] (.+)'
output = "{1}"

[on_failure]
tail = 30
output = "spotless: formatting violations found\n{output}"

[fallback]
tail = 10

Examples

spotless violations show file list and diffs ~976 tokens → ~307 tokens (69% saved)
Raw output
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.fusesource.jansi.internal.JansiLoader in an unnamed module (file:/Users/dev/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/lib/jansi-2.4.0.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/Users/dev/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/lib/guava-32.0.1-jre.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:core:jar:2.1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.testcontainers:testcontainers-bom:pom
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] my-service                                                         [pom]
[INFO] core                                                               [jar]
[INFO] algorithm                                                          [jar]
[INFO] api                                                                [jar]
[INFO]
[INFO] -----------------------< com.example:my-service >-----------------------
[INFO] Building my-service 2.1.0-SNAPSHOT                                [1/4]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ my-service ---
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO]
[INFO] -------------------------< com.example:core >--------------------------
[INFO] Building core 2.1.0-SNAPSHOT                                      [2/4]
[INFO]   from core/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ core ---
[ERROR] > The following files had format violations:
[ERROR]     src/main/kotlin/com/example/core/model/SlotEntity.kt
[ERROR]         @@ -12,3 +12,3 @@
[ERROR]         -····val·duration:·Int,
[ERROR]         +····val·duration:Int,
[ERROR]     src/main/kotlin/com/example/core/model/ScheduleEntity.kt
[ERROR]         @@ -8,3 +8,3 @@
[ERROR]         -····val·startTime:·LocalTime,
[ERROR]         +····val·startTime:LocalTime,
[ERROR] > Run 'mvn spotless:apply' to fix these violations.
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:3.1.0:check (default-cli) on project core: The following files had format violations:
[ERROR]     src/main/kotlin/com/example/core/model/SlotEntity.kt
[ERROR]     src/main/kotlin/com/example/core/model/ScheduleEntity.kt
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Filtered output
spotless: formatting violations found
[INFO] my-service                                                         [pom]
[INFO] core                                                               [jar]
[INFO] algorithm                                                          [jar]
[INFO] api                                                                [jar]
[INFO] Building my-service 2.1.0-SNAPSHOT                                [1/4]
[INFO] Building core 2.1.0-SNAPSHOT                                      [2/4]
> The following files had format violations:
    src/main/kotlin/com/example/core/model/SlotEntity.kt
        @@ -12,3 +12,3 @@
        -····val·duration:·Int,
        +····val·duration:Int,
    src/main/kotlin/com/example/core/model/ScheduleEntity.kt
        @@ -8,3 +8,3 @@
        -····val·startTime:·LocalTime,
        +····val·startTime:LocalTime,
> Run 'mvn spotless:apply' to fix these violations.
Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:3.1.0:check (default-cli) on project core: The following files had format violations:
    src/main/kotlin/com/example/core/model/SlotEntity.kt
    src/main/kotlin/com/example/core/model/ScheduleEntity.kt
[ERROR]
[ERROR]
clean spotless check shows single clean line ~1901 tokens → ~3 tokens (100% saved)
Raw output
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.fusesource.jansi.internal.JansiLoader in an unnamed module (file:/Users/dev/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/lib/jansi-2.4.0.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/Users/dev/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/lib/guava-32.0.1-jre.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:core:jar:2.1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.testcontainers:testcontainers-bom:pom
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] my-service                                                         [pom]
[INFO] core                                                               [jar]
[INFO] algorithm                                                          [jar]
[INFO] api                                                                [jar]
[INFO] consumer                                                           [jar]
[INFO] migrator                                                           [jar]
[INFO]
[INFO] -----------------------< com.example:my-service >-----------------------
[INFO] Building my-service 2.1.0-SNAPSHOT                                [1/6]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ my-service ---
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 0 were already clean, 1 were skipped because caching determined they were already clean
[INFO]
[INFO] -------------------------< com.example:core >--------------------------
[INFO] Building core 2.1.0-SNAPSHOT                                      [2/6]
[INFO]   from core/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ core ---
[INFO] Spotless.Kotlin is keeping 181 files clean - 0 needs changes to be clean, 6 were already clean, 175 were skipped because caching determined they were already clean
[INFO] Sorting file /var/folders/wr/tmp123/pom760564804703012630.xml
[INFO] Pom file is already sorted, exiting
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO]
[INFO] -----------------------< com.example:algorithm >-----------------------
[INFO] Building algorithm 2.1.0-SNAPSHOT                                 [3/6]
[INFO]   from algorithm/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ algorithm ---
[INFO] Spotless.Kotlin is keeping 106 files clean - 0 needs changes to be clean, 1 were already clean, 105 were skipped because caching determined they were already clean
[INFO] Sorting file /var/folders/wr/tmp123/pom12875647658671052518.xml
[INFO] Pom file is already sorted, exiting
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO]
[INFO] --------------------------< com.example:api >--------------------------
[INFO] Building api 2.1.0-SNAPSHOT                                       [4/6]
[INFO]   from api/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ api ---
[INFO] File stored in the index does not exist: src/main/kotlin/com/example/api/model/SomeModel.kt
[INFO] Spotless.Kotlin is keeping 180 files clean - 0 needs changes to be clean, 35 were already clean, 145 were skipped because caching determined they were already clean
[INFO] Sorting file /var/folders/wr/tmp123/pom8815273287386501545.xml
[INFO] Pom file is already sorted, exiting
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO]
[INFO] -----------------------< com.example:consumer >------------------------
[INFO] Building consumer 2.1.0-SNAPSHOT                                  [5/6]
[INFO]   from consumer/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ consumer ---
[INFO] Index file does not exist. Fallback to an empty index
[INFO] Spotless.Kotlin is keeping 32 files clean - 0 needs changes to be clean, 32 were already clean, 0 were skipped because caching determined they were already clean
[INFO] Sorting file /var/folders/wr/tmp123/pom1443401623306210788.xml
[INFO] Pom file is already sorted, exiting
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 1 were already clean, 0 were skipped because caching determined they were already clean
[INFO]
[INFO] -----------------------< com.example:migrator >------------------------
[INFO] Building migrator 2.1.0-SNAPSHOT                                  [6/6]
[INFO]   from migrator/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:check (default-cli) @ migrator ---
[INFO] Spotless.Kotlin is keeping 15 files clean - 0 needs changes to be clean, 0 were already clean, 15 were skipped because caching determined they were already clean
[INFO] Spotless.Pom is keeping 1 files clean - 0 needs changes to be clean, 0 were already clean, 1 were skipped because caching determined they were already clean
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for my-service 2.1.0-SNAPSHOT:
[INFO]
[INFO] my-service ......................................... SUCCESS [  1.273 s]
[INFO] core ............................................... SUCCESS [  0.075 s]
[INFO] algorithm .......................................... SUCCESS [  0.062 s]
[INFO] api ................................................ SUCCESS [  0.096 s]
[INFO] consumer ........................................... SUCCESS [  0.034 s]
[INFO] migrator ........................................... SUCCESS [  0.029 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.852 s
[INFO] Finished at: 2026-03-02T11:51:12+01:00
[INFO] ------------------------------------------------------------------------
Filtered output
spotless: clean
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.
Browse all filters