Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven plugin should support skip #491

Closed
thegreystone opened this issue Nov 27, 2019 · 3 comments · Fixed by #1353
Closed

Maven plugin should support skip #491

thegreystone opened this issue Nov 27, 2019 · 3 comments · Fixed by #1353

Comments

@thegreystone
Copy link

Many maven plug-ins support skipping the plug-in altogether when skip is set to true in the configuration. In a big tree of modules, that can be useful for supporting setting up reasonable defaults, and then opting out in modules where this is not necessary. So, e.g.:

  	<plugin>
  			<groupId>com.diffplug.spotless</groupId>
  			<artifactId>spotless-maven-plugin</artifactId>
  			<configuration>
				<skip>true</skip>
  			</configuration>
  	</plugin>
@nedtwigg
Copy link
Member

Happy to merge a PR for this.

@nedtwigg nedtwigg changed the title Should support skip Maven plugin should support skip Nov 27, 2019
@essobedo
Copy link

essobedo commented Oct 11, 2021

Unless I missed something, it seems to already be supported by the plugin as you can see in the source code.

Indeed with the next configuration:

 <plugin>
    <groupId>com.diffplug.spotless</groupId>
    <artifactId>spotless-maven-plugin</artifactId>
    <version>${spotless-maven-plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>apply</goal>
            </goals>
            <phase>validate</phase>
        </execution>
    </executions>
    <configuration>
        <skip>true</skip>
        <java>
            <googleJavaFormat />
        </java>
    </configuration>
</plugin>

If I launch my build, I can see in my console:

[INFO] --- spotless-maven-plugin:2.17.0:apply (default) @ java-ref-app-api ---
[INFO] Spotless apply skipped
[INFO] 

You can also skip it using the properties spotless.apply.skip for the apply task and spotless.check.skip for the check task with a command of type mvn <phases> -Dspotless.apply.skip

@nedtwigg
Copy link
Member

Fixed by @tisonkun, available in plugin-maven 2.27.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants