Skip to content

Spotless Plugin Not Applied and Build Passes Despite Errors #18470 #18479 #18534

@Pankraz76

Description

@Pankraz76

Summary

Spotless formatting tool fails locally but CI doesn't detect the issues. Similar to the PMD problem (#18479), there's inconsistency between local and CI environments.

Details

After recent CI configuration changes, Spotless is not properly failing the build in CI when formatting issues are found locally. This suggests either:

  1. Spotless is not running in CI
  2. Spotless configuration differs between local and CI
  3. CI is configured to ignore Spotless failures

Expected Behavior

  • Spotless should run successfully both locally and in CI
  • CI should fail when Spotless detects formatting violations
  • Local and CI behavior should be consistent
  • Developers should get immediate feedback about formatting issues

Current Behavior

  • Spotless fails when running locally (./mvnw spotless:check)
  • CI pipeline continues without detecting the Spotless failures
  • Inconsistent behavior between local development and CI environments

Impact

  • Code formatting inconsistencies may reach the repository
  • Developers waste time debugging formatting issues that CI should catch
  • Inconsistent code style across the codebase
  • Reduced effectiveness of automated formatting tools

Steps to Reproduce

  1. Run locally: ./mvnw spotless:check
  2. Observe formatting violations (if any)
  3. Push changes to CI
  4. CI passes even though local check failed

Configuration Check Needed

Verify:

  • Spotless is included in CI pipeline
  • Spotless configuration is identical in local and CI
  • CI properly fails on Spotless violations
  • No -DskipSpotless or similar flags in CI configuration

Related Issues

Notes

Similar to the PMD issue, this suggests a configuration discrepancy. Need to ensure:

  1. Spotless runs in CI with same parameters as local
  2. CI correctly interprets Spotless exit codes
  3. No silent skipping of Spotless in CI workflow
Caused by: org.apache.maven.plugin.MojoExecutionException: The following files had format violations:
    target/test-classes/com/puppycrawl/tools/checkstyle/grammar/comments/InputComments1.java                                                                                                                                             
        @@ -1,3 +1,22 @@                                                                                                                                                                                                                 
        +///////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                 
        +//·checkstyle:·Checks·Java·source·code·and·other·text·files·for·adherence·to·a·set·of·rules.                                                                                                                                    
        +//·Copyright·(C)·2001-2026·the·original·author·or·authors.                                                                                                                                                                      
        +//                                                                                                                                                                                                                              
        +//·This·library·is·free·software;·you·can·redistribute·it·and/or                                                                                                                                                                
        +//·modify·it·under·the·terms·of·the·GNU·Lesser·General·Public                                                                                                                                                                   
        +//·License·as·published·by·the·Free·Software·Foundation;·either                                                                                                                                                                 
        +//·version·2.1·of·the·License,·or·(at·your·option)·any·later·version.                                                                                                                                                           
        +//                                                                                                                                                                                                                              
        +//·This·library·is·distributed·in·the·hope·that·it·will·be·useful,                                                                                                                                                              
        +//·but·WITHOUT·ANY·WARRANTY;·without·even·the·implied·warranty·of                                                                                                                                                               
        +//·MERCHANTABILITY·or·FITNESS·FOR·A·PARTICULAR·PURPOSE.··See·the·GNU                                                                                                                                                            
        +//·Lesser·General·Public·License·for·more·details.                                                                                                                                                                              
        +//                                                                                                                                                                                                                              
        +//·You·should·have·received·a·copy·of·the·GNU·Lesser·General·Public                                                                                                                                                             
        +//·License·along·with·this·library;·if·not,·write·to·the·Free·Software                                                                                                                                                          
        +//·Foundation,·Inc.,·59·Temple·Place,·Suite·330,·Boston,·MA··02111-1307··USA                                                                                                                                                    
        +///////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                 
        +                                                                                                                                                                                                                                
         package·com.puppycrawl.tools.checkstyle.grammar.comments;                                                                                                                                                                       
         public·class·/*                                                                                                                                                                                                                 
         ····i'mcomment567                                                                                                                                                                                                               
    target/test-classes/com/puppycrawl/tools/checkstyle/grammar/java16/InputPatternVariableWithModifiers.java                                                                                                                            
        @@ -1,4 +1,22 @@                                                                                                                                                                                                                 
        -//·Java17                                                                                                                                                                                                                       
        +///////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                 
        +//·checkstyle:·Checks·Java·source·code·and·other·text·files·for·adherence·to·a·set·of·rules.                                                                                                                                    
        +//·Copyright·(C)·2001-2026·the·original·author·or·authors.                                                                                                                                                                      
        +//                                                                                                                                                                                                                              
        +//·This·library·is·free·software;·you·can·redistribute·it·and/or                                                                                                                                                                
        +//·modify·it·under·the·terms·of·the·GNU·Lesser·General·Public                                                                                                                                                                   
        +//·License·as·published·by·the·Free·Software·Foundation;·either                                                                                                                                                                 
        +//·version·2.1·of·the·License,·or·(at·your·option)·any·later·version.                                                                                                                                                           
        +//                                                                                                                                                                                                                              
        +//·This·library·is·distributed·in·the·hope·that·it·will·be·useful,                                                                                                                                                              
        +//·but·WITHOUT·ANY·WARRANTY;·without·even·the·implied·warranty·of                                                                                                                                                               
        +//·MERCHANTABILITY·or·FITNESS·FOR·A·PARTICULAR·PURPOSE.··See·the·GNU                                                                                                                                                            
        +//·Lesser·General·Public·License·for·more·details.                                                                                                                                                                              
        +//                                                                                                                                                                                                                              
        +//·You·should·have·received·a·copy·of·the·GNU·Lesser·General·Public                                                                                                                                                             
        +//·License·along·with·this·library;·if·not,·write·to·the·Free·Software                                                                                                                                                          
        +//·Foundation,·Inc.,·59·Temple·Place,·Suite·330,·Boston,·MA··02111-1307··USA                                                                                                                                                    
        +///////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                 
        +                                                                                                                                                                                                                                
         package·com.puppycrawl.tools.checkstyle.grammar.java16;                                                                                                                                                                         
                                                                                                                                                                                                                                         
         public·class·InputPatternVariableWithModifiers·{                                                                                                                                                                                
    target/test-classes/com/puppycrawl/tools/checkstyle/grammar/InputJava7StringSwitch.java                                                                                                                                              
        @@ -1,13 +1,21 @@                                                                                                                                                                                                                
        -/*                                                                                                                                                                                                                              
        -com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck                                                                                                                                                                   
    ... (29 more lines that didn't fit)                                                                                                                                                                                                  
Violations also present in 2438 other files.                                                                                                                                                                                             
Run 'mvn spotless:apply' to fix these violations.                                                                                                                                                                                        
    at com.diffplug.spotless.maven.SpotlessCheckMojo.process (SpotlessCheckMojo.java:120)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:275)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:565)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[ERROR] 
[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/MojoExecutionException
➜  checkstyle git:(master) ./mvnw -e --no-transfer-progress spotless:check

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions