Package org.apache.maven.enforcer.rules
Class RequirePluginVersions
java.lang.Object
org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
org.apache.maven.enforcer.rules.RequirePluginVersions
- All Implemented Interfaces:
EnforcerRuleBase
@Named("requirePluginVersions")
public final class RequirePluginVersions
extends AbstractStandardEnforcerRule
This rule will enforce that all plugins specified in the poms have a version declared.
- Author:
- Brian Fox
-
Constructor Summary
ConstructorDescriptionRequirePluginVersions
(org.apache.maven.plugin.PluginManager pluginManager, org.apache.maven.artifact.factory.ArtifactFactory factory, org.eclipse.aether.RepositorySystem repositorySystem, org.apache.maven.execution.MavenSession session, EnforcerRuleUtils utils, org.apache.maven.rtinfo.RuntimeInformation runtimeInformation, org.apache.maven.lifecycle.DefaultLifecycles defaultLifeCycles, org.apache.maven.project.MavenProject project, ExpressionEvaluator evaluator, org.codehaus.plexus.PlexusContainer container) -
Method Summary
Modifier and TypeMethodDescriptionSet<org.apache.maven.model.Plugin>
addAdditionalPlugins
(Set<org.apache.maven.model.Plugin> existing, List<String> additional) Add the additional plugins if they don't exist yet.combineUncheckedPlugins
(Collection<String> uncheckedPlugins, String uncheckedPluginsList) Combines the old Collection with the new comma separated list.void
execute()
getLog()
Gets the phase to lifecycle map.Set<org.apache.maven.model.Plugin>
getProfilePlugins
(org.apache.maven.project.MavenProject project) Finds the plugins that are listed in active profiles.boolean
hasValidVersionSpecified
(org.apache.maven.model.Plugin source, List<PluginWrapper> pluginWrappers) Checks for valid version specified.boolean
Checks if is ban snapshots.void
setBanLatest
(boolean theBanLatest) Sets the ban latest.void
setBanRelease
(boolean theBanRelease) Sets the ban release.void
setBanSnapshots
(boolean theBanSnapshots) Sets the ban snapshots.void
setBanTimestamps
(boolean theBanTimestamps) Sets the ban timestamps.void
setLog
(EnforcerLogger arg0) toString()
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel
-
Constructor Details
-
RequirePluginVersions
@Inject public RequirePluginVersions(org.apache.maven.plugin.PluginManager pluginManager, org.apache.maven.artifact.factory.ArtifactFactory factory, org.eclipse.aether.RepositorySystem repositorySystem, org.apache.maven.execution.MavenSession session, EnforcerRuleUtils utils, org.apache.maven.rtinfo.RuntimeInformation runtimeInformation, org.apache.maven.lifecycle.DefaultLifecycles defaultLifeCycles, org.apache.maven.project.MavenProject project, ExpressionEvaluator evaluator, org.codehaus.plexus.PlexusContainer container)
-
-
Method Details
-
execute
- Specified by:
execute
in classAbstractEnforcerRule
- Throws:
EnforcerRuleException
-
combineUncheckedPlugins
public Collection<String> combineUncheckedPlugins(Collection<String> uncheckedPlugins, String uncheckedPluginsList) Combines the old Collection with the new comma separated list.- Parameters:
uncheckedPlugins
- a new collectionsuncheckedPluginsList
- a list to merge- Returns:
- List of unchecked plugins.
-
addAdditionalPlugins
public Set<org.apache.maven.model.Plugin> addAdditionalPlugins(Set<org.apache.maven.model.Plugin> existing, List<String> additional) throws EnforcerRuleError Add the additional plugins if they don't exist yet.- Parameters:
existing
- the existingadditional
- the additional- Returns:
- the sets the
- Throws:
EnforcerRuleError
- the enforcer error
-
getProfilePlugins
public Set<org.apache.maven.model.Plugin> getProfilePlugins(org.apache.maven.project.MavenProject project) Finds the plugins that are listed in active profiles.- Parameters:
project
- the project- Returns:
- the profile plugins
-
hasValidVersionSpecified
public boolean hasValidVersionSpecified(org.apache.maven.model.Plugin source, List<PluginWrapper> pluginWrappers) Checks for valid version specified. Checks to see if the version is specified for the plugin. Can optionally ban "RELEASE" or "LATEST" even if specified.- Parameters:
source
- the sourcepluginWrappers
- the plugins- Returns:
- true, if successful
-
getPhaseToLifecycleMap
public Map<String,org.apache.maven.lifecycle.Lifecycle> getPhaseToLifecycleMap() throws org.apache.maven.lifecycle.LifecycleExecutionExceptionGets the phase to lifecycle map.- Returns:
- the phase to lifecycle map
- Throws:
org.apache.maven.lifecycle.LifecycleExecutionException
- the lifecycle execution exception
-
setBanLatest
Sets the ban latest.- Parameters:
theBanLatest
- the banLatest to set
-
setBanRelease
Sets the ban release.- Parameters:
theBanRelease
- the banRelease to set
-
isBanSnapshots
Checks if is ban snapshots.- Returns:
- the banSnapshots
-
setBanSnapshots
Sets the ban snapshots.- Parameters:
theBanSnapshots
- the banSnapshots to set
-
setBanTimestamps
Sets the ban timestamps.- Parameters:
theBanTimestamps
- the banTimestamps to set
-
toString
-
setLog
- Specified by:
setLog
in interfaceEnforcerRuleBase
-
getLog
-