Package com.spotify.fmt
Class AbstractFMT
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.spotify.fmt.AbstractFMT
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
public abstract class AbstractFMT
extends org.apache.maven.plugin.AbstractMojo
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate File[]private booleanprivate Stringprivate Stringprivate StringOption to specify whether to run google-java-format in a fork or in-process.private Stringprivate FormattingResultprivate booleanprivate booleanprivate booleanprivate booleanprivate Fileprivate Stringprivate File(package private) booleanWhether to use the classpath from the java.class.path property when forking.private booleanFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()execute.protected abstract StringProvides the name of the label used when a non-formatted file is found.private voidhandleMissingDirectory(String directoryDisplayName, File directory) javaArgs()protected voidpostExecute(FormattingResult result) Post Execute action.(package private) booleanprotected abstract booleanWhether to write reformatted files to disk.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
sourceDirectory
@Parameter(defaultValue="${project.build.sourceDirectory}", property="sourceDirectory", required=true) private File sourceDirectory -
testSourceDirectory
@Parameter(defaultValue="${project.build.testSourceDirectory}", property="testSourceDirectory", required=true) private File testSourceDirectory -
packaging
-
additionalSourceDirectories
-
verbose
@Parameter(defaultValue="false", property="verbose") private boolean verbose -
failOnUnknownFolder
@Parameter(defaultValue="false", property="failOnUnknownFolder") private boolean failOnUnknownFolder -
filesNamePattern
-
filesPathPattern
-
skip
@Parameter(defaultValue="false", property="fmt.skip") private boolean skip -
skipSourceDirectory
@Parameter(defaultValue="false", property="skipSourceDirectory") private boolean skipSourceDirectory -
skipTestSourceDirectory
@Parameter(defaultValue="false", property="skipTestSourceDirectory") private boolean skipTestSourceDirectory -
skipSortingImports
@Parameter(defaultValue="false", property="skipSortingImports") private boolean skipSortingImports -
style
-
forkMode
Option to specify whether to run google-java-format in a fork or in-process. Can bedefault,neverandalways. Also adds JVM arguments when needed.Specifying
default(which is the default) will fork when JDK 16+ is detected. Specifyingneverwill never fork and instead run in-process, regardless of JDK version. Specifyingalwayswill always fork, regardless of JDK version. -
pluginArtifactMap
-
useDefaultClasspathWhenForking
boolean useDefaultClasspathWhenForkingWhether to use the classpath from the java.class.path property when forking. Only intended for use by unit tests. -
result
-
-
Constructor Details
-
AbstractFMT
public AbstractFMT()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoFailureExceptionexecute.- Throws:
org.apache.maven.plugin.MojoFailureException
-
shouldFork
boolean shouldFork() -
postExecute
protected void postExecute(FormattingResult result) throws org.apache.maven.plugin.MojoFailureException Post Execute action. It is called at the end of the execute method. Subclasses can add extra checks.- Parameters:
result- The formatting result- Throws:
org.apache.maven.plugin.MojoFailureException
-
getResult
-
handleMissingDirectory
private void handleMissingDirectory(String directoryDisplayName, File directory) throws org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoFailureException
-
shouldWriteReformattedFiles
protected abstract boolean shouldWriteReformattedFiles()Whether to write reformatted files to disk. -
getProcessingLabel
Provides the name of the label used when a non-formatted file is found.- Returns:
- the label to use in the log
-
javaArgs
-