Interface MojoMetadataProvider.Context
-
- Enclosing interface:
- MojoMetadataProvider
public static interface MojoMetadataProvider.ContextAllows configuring the inputs and outputs of a Mojo.- Since:
- 1.21
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMojoMetadataProvider.Context.FileSetHolds a set of files and directories and allows configuring theMojoMetadataProvider.Context.FileSet.NormalizationStrategy,MojoMetadataProvider.Context.FileSet.LineEndingHandlingandMojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling.static interfaceMojoMetadataProvider.Context.InputsThe inputs of a goal determine its cache key.static interfaceMojoMetadataProvider.Context.LocalStateConfigures local state.static interfaceMojoMetadataProvider.Context.OutputsThe outputs of a goal are packed into the cache entry and restored when they are loaded from the build cache.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MojoExecutiongetMojoExecution()The goal execution being analyzed.MavenProjectgetProject()The project that the goal execution is part of.MavenSessiongetSession()The session associated with the project.java.lang.ObjectgetUnderlyingObject()The object underlying the current context.MojoMetadataProvider.Contextinputs(java.util.function.Consumer<? super MojoMetadataProvider.Context.Inputs> action)The inputs of a goal determine its cache key.MojoMetadataProvider.Contextiterate(java.lang.String propertyName, java.util.function.Consumer<? super MojoMetadataProvider.Context> action)Creates nested contexts by looking for a property of typeIterableorObject[]with the given name in the current context and calling the given action on each item in theIterableorObject[], if it exists.MojoMetadataProvider.ContextlocalState(java.util.function.Consumer<? super MojoMetadataProvider.Context.LocalState> action)Local state is deleted if the outputs of a goal are retrieved from the build cache.MojoMetadataProvider.Contextnested(java.lang.String propertyName, java.util.function.Consumer<? super MojoMetadataProvider.Context> action)Creates a nested context by looking for a property with the given name on the current context and calling the given action on it if it exists.MojoMetadataProvider.Contextoutputs(java.util.function.Consumer<? super MojoMetadataProvider.Context.Outputs> action)The outputs of a goal are packed into the cache entry.MojoMetadataProvider.ContextskipIfTrue(java.lang.String... propertyNames)The goal execution will be skipped, if any of the given boolean properties istrue.MojoMetadataProvider.ContextskipIfTrue(java.util.List<java.lang.String> propertyNames)The goal execution will be skipped, if any of the given boolean properties istrue.voidwithPlugin(java.lang.String artifactId, java.lang.Runnable action)
-
-
-
Method Detail
-
getUnderlyingObject
java.lang.Object getUnderlyingObject()
The object underlying the current context. The root context will return theMojoinstance, while contexts created bynested(String, Consumer)anditerate(String, Consumer)will return the nested property value.
-
getMojoExecution
MojoExecution getMojoExecution()
The goal execution being analyzed.
-
getProject
MavenProject getProject()
The project that the goal execution is part of.
-
getSession
MavenSession getSession()
The session associated with the project.
-
withPlugin
void withPlugin(java.lang.String artifactId, java.lang.Runnable action)Executes a givenactionif the suppliedartifactIdmatchesPlugin.getArtifactId(). If two plugins have the same artifactId but different groupIds the action will be executed for both.- Parameters:
artifactId- the artifact id for which to execute theactionaction- the action to be executed
-
skipIfTrue
MojoMetadataProvider.Context skipIfTrue(java.lang.String... propertyNames)
The goal execution will be skipped, if any of the given boolean properties istrue.- Parameters:
propertyNames- the names of the boolean properties to be checked
-
skipIfTrue
MojoMetadataProvider.Context skipIfTrue(java.util.List<java.lang.String> propertyNames)
The goal execution will be skipped, if any of the given boolean properties istrue.- Parameters:
propertyNames- the names of the boolean properties to be checked
-
inputs
MojoMetadataProvider.Context inputs(java.util.function.Consumer<? super MojoMetadataProvider.Context.Inputs> action)
The inputs of a goal determine its cache key.- Parameters:
action- to be executed on the suppliedMojoMetadataProvider.Context.Inputs- See Also:
for more details
-
outputs
MojoMetadataProvider.Context outputs(java.util.function.Consumer<? super MojoMetadataProvider.Context.Outputs> action)
The outputs of a goal are packed into the cache entry.- Parameters:
action- to be executed on the suppliedMojoMetadataProvider.Context.Outputs- See Also:
for more details
-
localState
MojoMetadataProvider.Context localState(java.util.function.Consumer<? super MojoMetadataProvider.Context.LocalState> action)
Local state is deleted if the outputs of a goal are retrieved from the build cache. A common example would be temporary files or incremental analysis data.- Parameters:
action- to be executed on the suppliedMojoMetadataProvider.Context.LocalState- See Also:
for more details
-
nested
MojoMetadataProvider.Context nested(java.lang.String propertyName, java.util.function.Consumer<? super MojoMetadataProvider.Context> action)
Creates a nested context by looking for a property with the given name on the current context and calling the given action on it if it exists. All property names in the nested context will be prefixed with the given property name.- Parameters:
propertyName- the name of the property to look for on the current contextaction- the action to be executed if the suppliedpropertyNameis found on the current context
-
iterate
MojoMetadataProvider.Context iterate(java.lang.String propertyName, java.util.function.Consumer<? super MojoMetadataProvider.Context> action)
Creates nested contexts by looking for a property of typeIterableorObject[]with the given name in the current context and calling the given action on each item in theIterableorObject[], if it exists. All property names in the nested contexts will be prefixed with the given property name and the index of the item in theIterableorObject[].- Parameters:
propertyName- the name of the property to look for on the current contextaction- the action to be executed if the suppliedpropertyNameis found on the current context
-
-