Interface MojoMetadataProvider.Context
- Enclosing interface:
MojoMetadataProvider
public static interface MojoMetadataProvider.Context
Allows configuring the inputs and outputs of a Mojo.
- Since:
- 1.21
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Holds a set of files and directories and allows configuring theMojoMetadataProvider.Context.FileSet.NormalizationStrategy
,MojoMetadataProvider.Context.FileSet.LineEndingHandling
andMojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling
.static interface
The inputs of a goal determine its cache key.static interface
Configures local state.static interface
The outputs of a goal are packed into the cache entry and restored when they are loaded from the build cache. -
Method Summary
Modifier and TypeMethodDescriptionThe goal execution being analyzed.The project that the goal execution is part of.The session associated with the project.The object underlying the current context.inputs
(Consumer<? super MojoMetadataProvider.Context.Inputs> action) The inputs of a goal determine its cache key.iterate
(String propertyName, Consumer<? super MojoMetadataProvider.Context> action) localState
(Consumer<? super MojoMetadataProvider.Context.LocalState> action) Local state is deleted if the outputs of a goal are retrieved from the build cache.nested
(String propertyName, 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.outputs
(Consumer<? super MojoMetadataProvider.Context.Outputs> action) The outputs of a goal are packed into the cache entry.skipIfTrue
(String... propertyNames) The goal execution will be skipped, if any of the given boolean properties istrue
.skipIfTrue
(List<String> propertyNames) The goal execution will be skipped, if any of the given boolean properties istrue
.void
withPlugin
(String artifactId, Runnable action)
-
Method Details
-
getUnderlyingObject
Object getUnderlyingObject()The object underlying the current context. The root context will return theMojo
instance, 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
Executes a givenaction
if the suppliedartifactId
matchesPlugin.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 theaction
action
- the action to be executed
-
skipIfTrue
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
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
The inputs of a goal determine its cache key.- Parameters:
action
- to be executed on the suppliedMojoMetadataProvider.Context.Inputs
- See Also:
-
outputs
The outputs of a goal are packed into the cache entry.- Parameters:
action
- to be executed on the suppliedMojoMetadataProvider.Context.Outputs
- See Also:
-
localState
MojoMetadataProvider.Context localState(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:
-
nested
MojoMetadataProvider.Context nested(String propertyName, 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 suppliedpropertyName
is found on the current context
-
iterate
MojoMetadataProvider.Context iterate(String propertyName, Consumer<? super MojoMetadataProvider.Context> action) Creates nested contexts by looking for a property of typeIterable
orObject[]
with the given name in the current context and calling the given action on each item in theIterable
orObject[]
, 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 theIterable
orObject[]
.- Parameters:
propertyName
- the name of the property to look for on the current contextaction
- the action to be executed if the suppliedpropertyName
is found on the current context
-