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 TypeMethodDescriptionvoid
execute
(EnforcerRuleHelper theHelper) This is the interface into the rule.final String
final boolean
isAll()
protected boolean
isProfileActive
(org.apache.maven.project.MavenProject project, String profileName) Checks if profile is active.final void
setAll
(boolean all) final void
setProfiles
(String profiles) Methods inherited from class org.apache.maven.plugins.enforcer.AbstractNonCacheableEnforcerRule
getCacheId, isCacheable, isResultValid
Methods 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: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, String profileName) Checks if profile is active.- Parameters:
project
- the projectprofileName
- the profile name- Returns:
true
if profile is active, otherwisefalse
-