From dc9f4291f80bcb15dd63721abbba70f4ab0c371a Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 28 Sep 2022 21:18:52 +0800 Subject: [PATCH 1/2] fix: maven plugin should identify skip config key Signed-off-by: tison --- .../com/diffplug/spotless/maven/AbstractSpotlessMojo.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java index c68733f387..f163fa2802 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java @@ -91,6 +91,9 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo { @Parameter(defaultValue = "${mojoExecution.goal}", required = true, readonly = true) private String goal; + @Parameter(defaultValue = "false") + private boolean skip; + @Parameter(property = "spotless.apply.skip", defaultValue = "false") private boolean applySkip; @@ -200,6 +203,10 @@ public final void execute() throws MojoExecutionException { } private boolean shouldSkip() { + if (skip) { + return true; + } + switch (goal) { case GOAL_CHECK: return checkSkip; @@ -208,6 +215,7 @@ private boolean shouldSkip() { default: break; } + return false; } From 622f3a0c0bdb679a9f3a9123ba598dd2e6201be7 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 28 Sep 2022 22:48:37 +0800 Subject: [PATCH 2/2] update CHANGES Signed-off-by: tison --- plugin-maven/CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 6c3ff896a9..d46447ea38 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* `skip` config key should work again now. ([#1353](https://github.com/diffplug/spotless/pull/1353) fixes [#1227](https://github.com/diffplug/spotless/issues/1227) and [#491](https://github.com/diffplug/spotless/issues/491)) ## [2.27.0] - 2022-09-19 ### Added