Class ConditionProfileActivator

java.lang.Object
org.apache.maven.internal.impl.model.profile.ConditionProfileActivator
All Implemented Interfaces:
ProfileActivator

@Named("condition") @Singleton public class ConditionProfileActivator extends Object implements ProfileActivator
This class is responsible for activating profiles based on conditions specified in the profile's activation section. It evaluates the condition expression and determines whether the profile should be active.
  • Constructor Details

    • ConditionProfileActivator

      @Inject public ConditionProfileActivator(VersionParser versionParser)
      Constructs a new ConditionProfileActivator with the necessary dependencies.
      Parameters:
      versionParser - The parser for handling version comparisons
  • Method Details

    • isActive

      public boolean isActive(Profile profile, ProfileActivationContext context, ModelProblemCollector problems)
      Determines whether a profile should be active based on its condition.
      Specified by:
      isActive in interface ProfileActivator
      Parameters:
      profile - The profile to evaluate
      context - The context in which the profile is being evaluated
      problems - A collector for any problems encountered during evaluation
      Returns:
      true if the profile should be active, false otherwise
    • presentInConfig

      public boolean presentInConfig(Profile profile, ProfileActivationContext context, ModelProblemCollector problems)
      Checks if the condition is present in the profile's configuration.
      Specified by:
      presentInConfig in interface ProfileActivator
      Parameters:
      profile - The profile to check
      context - The context in which the profile is being evaluated
      problems - A collector for any problems encountered during evaluation
      Returns:
      true if the condition is present and not blank, false otherwise
    • registerFunctions

      public static Map<String,ConditionParser.ExpressionFunction> registerFunctions(ProfileActivationContext context, VersionParser versionParser)
      Registers the condition functions that can be used in profile activation expressions.
      Parameters:
      context - The profile activation context
      versionParser - The parser for handling version comparisons
      Returns:
      A map of function names to their implementations