Class RequireActiveProfile

    • Field Detail

      • profiles

        private java.lang.String profiles
        Comma separated list of profiles to check.
      • all

        private boolean all
        If all profiles must be active. If false, only one must be active
    • Constructor Detail

      • RequireActiveProfile

        public RequireActiveProfile()
    • Method Detail

      • getProfiles

        public final java.lang.String getProfiles()
      • setProfiles

        public final void setProfiles​(java.lang.String profiles)
      • isAll

        public final boolean isAll()
      • setAll

        public final void setAll​(boolean all)
      • execute

        public void execute​(EnforcerRuleHelper theHelper)
                     throws EnforcerRuleException
        Description copied from interface: EnforcerRule
        This is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag if it should stop or just log the message as a warning.
        Parameters:
        theHelper - The helper provides access to the log, MavenSession and has helpers to get common components. It is also able to lookup components by class name.
        Throws:
        EnforcerRuleException - the enforcer rule exception
      • isProfileActive

        protected boolean isProfileActive​(org.apache.maven.project.MavenProject project,
                                          java.lang.String profileId)
        Checks if profile is active.
        Parameters:
        project - the project
        profileId - the profile name
        Returns:
        true if profile is active, otherwise false