Gradle: Spotless task not firing when needed
<p>I followed the Spotless plugin's readme and included the following into my build.gradle:</p>

<pre><code>apply plugin: 'java'

spotless {
    java {
        eclipseFormatFile 'my-eclipse-format.xml' 
    }
}
</code></pre>

<p>When I run "gradlew build", I expect Spotless to a) format my code automatically using the above format; b) do a check (ie spotlessJavaCheck) to verify it happened. </p>

<p>Instead, I only get the b) part working. How can I make sure a) (formatting) happens automatically when I execute the build step? I don't want to explicitly call "gradlew spotlessApply build" but only "gradlew build".</p>

<p>I tried adding "build { dependsOn spotlessApply } but it says "cannot find property spotlessApply". </p>