Class IncrementalBuildHelper
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method collects and stores all information about files changed since the call tobeforeRebuildExecution()
.void
This method shall get invoked before the actual Mojo task gets triggered, e.g.We use a specific status directory for each Mojo execution to store state which is needed during the next build invocation run.boolean
inputFileTreeChanged
(List<String> added, List<String> removed) Detect whether the list of detected files has changed since the last build.
-
Field Details
-
CREATED_FILES_LST_FILENAME
- See Also:
-
-
Constructor Details
-
IncrementalBuildHelper
-
-
Method Details
-
getMojoStatusDirectory
We use a specific status directory for each Mojo execution to store state which is needed during the next build invocation run.- Returns:
- the directory for storing status information of the current Mojo execution.
- Throws:
org.apache.maven.api.plugin.MojoException
-
inputFileTreeChanged
Detect whether the list of detected files has changed since the last build. We simply load the list of files for the previous build from a status file and compare it with the new list. Afterwards we store the new list in the status file.- Returns:
true
if the set of inputFiles got changed since the last build.
-
beforeRebuildExecution
public void beforeRebuildExecution()This method shall get invoked before the actual Mojo task gets triggered, e.g. the actual compile in maven-compiler-plugin.
Attention: This method shall only get invoked if the plugin re-creates all the output.
It first picks up the list of files created in the previous build and delete them. This step is necessary to prevent left-overs. After that we take a 'directory snapshot' (list of all files which exist in the outputDirectory after the clean).
After the actual Mojo task got executed you should invoke the method
afterRebuildExecution()
to collect the list of files which got changed by this task. -
afterRebuildExecution
public void afterRebuildExecution()This method collects and stores all information about files changed since the call to
beforeRebuildExecution()
.Attention: This method shall only get invoked if the plugin re-creates all the output.
-