Class IncrementalBuildHelper
java.lang.Object
org.apache.maven.shared.incremental.IncrementalBuildHelper
Various helper methods to support incremental builds
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
private org.apache.maven.shared.utils.io.DirectoryScanner
Used for detecting changes between the Mojo execution.private static final String[]
private String[]
Once thebeforeRebuildExecution(org.apache.maven.shared.incremental.IncrementalBuildHelperRequest)
got called, this will contain the list of files in the build directory.private static final String
private static final String
the root directory to store status information about Maven executions in.private org.apache.maven.project.MavenProject
Needed for storing the status for the incremental build support.private org.apache.maven.plugin.MojoExecution
Needed for storing the status for the incremental build support. -
Constructor Summary
ConstructorsConstructorDescriptionIncrementalBuildHelper
(org.apache.maven.plugin.MojoExecution mojoExecution, org.apache.maven.execution.MavenSession mavenSession) IncrementalBuildHelper
(org.apache.maven.plugin.MojoExecution mojoExecution, org.apache.maven.project.MavenProject mavenProject) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterRebuildExecution
(IncrementalBuildHelperRequest incrementalBuildHelperRequest) This method collects and stores all information about files changed since the call tobeforeRebuildExecution(org.apache.maven.shared.incremental.IncrementalBuildHelperRequest)
.String[]
beforeRebuildExecution
(IncrementalBuildHelperRequest incrementalBuildHelperRequest) This method shall get invoked before the actual Mojo task gets triggered, e.g.org.apache.maven.shared.utils.io.DirectoryScanner
Get the existing DirectoryScanner used by this helper, or create new a DirectoryScanner if none is yet set.private static org.apache.maven.project.MavenProject
getMavenProject
(org.apache.maven.execution.MavenSession mavenSession) small helper method to allow for the nullcheck in the ct invocationWe use a specific status directory for each Mojo execution to store state which is needed during the next build invocation run.boolean
inputFileTreeChanged
(IncrementalBuildHelperRequest incrementalBuildHelperRequest) Detect whether the list of detected files has changed since the last build.boolean
inputFileTreeChanged
(org.apache.maven.shared.utils.io.DirectoryScanner dirScanner) Detect whether the list of detected files picked up by the DirectoryScanner has changed since the last build.void
setDirectoryScanner
(org.apache.maven.shared.utils.io.DirectoryScanner directoryScanner) Set the DirectoryScanner which shall get used by this build helper.private String[]
toArrayOfPath
(Set<File> files)
-
Field Details
-
MAVEN_STATUS_ROOT
the root directory to store status information about Maven executions in.- See Also:
-
CREATED_FILES_LST_FILENAME
- See Also:
-
INPUT_FILES_LST_FILENAME
- See Also:
-
EMPTY_ARRAY
-
mojoExecution
private org.apache.maven.plugin.MojoExecution mojoExecutionNeeded for storing the status for the incremental build support. -
mavenProject
private org.apache.maven.project.MavenProject mavenProjectNeeded for storing the status for the incremental build support. -
directoryScanner
private org.apache.maven.shared.utils.io.DirectoryScanner directoryScannerUsed for detecting changes between the Mojo execution. -
filesBeforeAction
Once thebeforeRebuildExecution(org.apache.maven.shared.incremental.IncrementalBuildHelperRequest)
got called, this will contain the list of files in the build directory.
-
-
Constructor Details
-
IncrementalBuildHelper
public IncrementalBuildHelper(org.apache.maven.plugin.MojoExecution mojoExecution, org.apache.maven.execution.MavenSession mavenSession) -
IncrementalBuildHelper
public IncrementalBuildHelper(org.apache.maven.plugin.MojoExecution mojoExecution, org.apache.maven.project.MavenProject mavenProject)
-
-
Method Details
-
getMavenProject
private static org.apache.maven.project.MavenProject getMavenProject(org.apache.maven.execution.MavenSession mavenSession) small helper method to allow for the nullcheck in the ct invocation -
getDirectoryScanner
public org.apache.maven.shared.utils.io.DirectoryScanner getDirectoryScanner()Get the existing DirectoryScanner used by this helper, or create new a DirectoryScanner if none is yet set. The DirectoryScanner is used for detecting changes in a directory -
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.plugin.MojoExecutionException
-
toArrayOfPath
-