|
26 | 26 | import java.util.LinkedHashMap;
|
27 | 27 | import java.util.List;
|
28 | 28 | import java.util.Map;
|
| 29 | +import java.util.Properties; |
29 | 30 | import java.util.stream.Collectors;
|
30 | 31 | import java.util.stream.Stream;
|
31 | 32 |
|
| 33 | +import org.apache.maven.execution.MavenSession; |
32 | 34 | import org.apache.maven.plugin.AbstractMojo;
|
33 | 35 | import org.apache.maven.plugin.MojoExecutionException;
|
34 | 36 | import org.apache.maven.plugin.MojoFailureException;
|
@@ -68,6 +70,12 @@ public abstract class FormatMojo extends AbstractMojo {
|
68 | 70 | @Parameter(defaultValue = "${project}", readonly = true, required = true)
|
69 | 71 | protected MavenProject project;
|
70 | 72 |
|
| 73 | + /** |
| 74 | + * The Maven Session Object. |
| 75 | + */ |
| 76 | + @Parameter(defaultValue = "${session}", readonly = true, required = true) |
| 77 | + protected MavenSession session; |
| 78 | + |
71 | 79 | /**
|
72 | 80 | * Specifies the location of the source directories to use.
|
73 | 81 | */
|
@@ -195,4 +203,16 @@ protected final FileFormatter getFormatter() {
|
195 | 203 | return new FileFormatter(javaFormatConfig);
|
196 | 204 | }
|
197 | 205 |
|
| 206 | + protected boolean skipGlobally() { |
| 207 | + boolean result = false; |
| 208 | + result = result || skipGlobally(this.session.getUserProperties()); |
| 209 | + result = result || skipGlobally(this.session.getSystemProperties()); |
| 210 | + result = result || skipGlobally(this.project.getProperties()); |
| 211 | + return result; |
| 212 | + } |
| 213 | + |
| 214 | + private boolean skipGlobally(Properties properties) { |
| 215 | + return Boolean.valueOf(properties.getProperty("spring-javaformat.skip")); |
| 216 | + } |
| 217 | + |
198 | 218 | }
|
0 commit comments