Class RequireActiveProfile
java.lang.Object
org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
org.apache.maven.plugins.enforcer.RequireActiveProfile
- All Implemented Interfaces:
EnforcerRule,EnforcerRule2
This rule checks that some profiles are active.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(EnforcerRuleHelper theHelper) This is the interface into the rule.final Stringfinal booleanisAll()protected booleanisProfileActive(org.apache.maven.project.MavenProject project, String profileId) Checks if profile is active.final voidsetAll(boolean all) final voidsetProfiles(String profiles) Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValidMethods inherited from class org.apache.maven.plugins.enforcer.AbstractStandardEnforcerRule
getLevel, getMessage, setLevel, setMessage
-
Field Details
-
profiles
Comma separated list of profiles to check. -
all
private boolean allIf all profiles must be active. If false, only one must be active
-
-
Constructor Details
-
RequireActiveProfile
public RequireActiveProfile()
-
-
Method Details
-
getProfiles
-
setProfiles
-
isAll
public final boolean isAll() -
setAll
public final void setAll(boolean all) -
execute
Description copied from interface:EnforcerRuleThis 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
Checks if profile is active.- Parameters:
project- the projectprofileId- the profile name- Returns:
trueif profile is active, otherwisefalse
-