Interface ProfileActivationContext
- All Known Implementing Classes:
DefaultProfileActivationContext
The Model is available from the activation context, but only static parts of it
are allowed to be used, i.e. those that do not change between file model and effective model.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a file or directory matching the given glob pattern exists at the specified path.Gets the artifactId from the current model.Gets the base directory of the current model.Gets the packaging type from the current model.getModelProperty(String key) Gets the model property to use for interpolation and profile activation.Gets the root directory of the current model.getSystemProperty(String key) Gets the system property to use for interpolation and profile activation.getUserProperty(String key) Gets the user property to use for interpolation and profile activation.interpolatePath(String path) Interpolates the given path string using the current context's properties.booleanisProfileActive(String profileId) Checks if the specified profile has been explicitly activated.booleanisProfileInactive(String profileId) Checks if the specified profile has been explicitly deactivated.
-
Method Details
-
isProfileActive
-
isProfileInactive
-
getSystemProperty
Gets the system property to use for interpolation and profile activation. The system properties are collected from the runtime environment likeSystem.getProperties()and environment variables.- Parameters:
key- the name of the system property- Returns:
- the system property for the specified key, or
null
-
getUserProperty
Gets the user property to use for interpolation and profile activation. The user properties have been configured directly by the user on his discretion, e.g. via the-Dkey=valueparameter on the command line.In repository-resolved (external) model builds (dependency POMs, parent POMs, imported BOMs), this always returns
null. Consumer-Dflags are not propagated to dependency profile activation: the consumer did not set those flags for the dependency, and doing so would make dependency resolution non-deterministic and open to accidental (or malicious) profile injection.- Parameters:
key- the name of the user property- Returns:
- The user property for the specified key, or
null.
-
getModelProperty
Gets the model property to use for interpolation and profile activation.These are the properties declared in the model's own
<properties>section. They are part of the artifact's published identity and are always consulted for profile activation, including in repository-resolved (external) model builds. UnlikegetUserProperty(String), these are never suppressed when evaluating dependency profiles.- Parameters:
key- the name of the model property- Returns:
- The model property for the specified key, or
null;
-
getModelArtifactId
-
getModelPackaging
-
getModelRootDirectory
-
getModelBaseDirectory
-
interpolatePath
Interpolates the given path string using the current context's properties.- Parameters:
path- The path string to interpolate- Returns:
- The interpolated path string
- Throws:
InterpolatorException- if an error occurs during interpolation
-
exists
Checks if a file or directory matching the given glob pattern exists at the specified path.- Parameters:
path- the base path to checkglob- whether the path can be a glob expression- Returns:
trueif a matching file exists,falseotherwise- Throws:
ModelBuilderException- if an error occurs while checking the pathInterpolatorException- if an error occurs during interpolation
-