public class RequirePluginVersions extends AbstractNonCacheableEnforcerRule
Constructor and Description |
---|
RequirePluginVersions() |
Modifier and Type | Method and Description |
---|---|
Set<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.
|
Collection<String> |
combineUncheckedPlugins(Collection<String> uncheckedPlugins,
String uncheckedPluginsList)
Combines the old Collection with the new comma separated list.
|
void |
execute(EnforcerRuleHelper helper)
This is the interface into the rule.
|
protected org.apache.maven.model.Plugin |
findCurrentPlugin(org.apache.maven.model.Plugin plugin,
org.apache.maven.project.MavenProject project)
Given a plugin, this will retrieve the matching plugin artifact from the model.
|
List<String> |
getAdditionalPlugins() |
protected List<PluginWrapper> |
getAllPluginEntries(org.apache.maven.project.MavenProject project)
Gets all plugin entries in build.plugins, build.pluginManagement.plugins, profile.build.plugins, reporting and
profile.reporting in this project and all parents
|
protected Set<org.apache.maven.model.Plugin> |
getBoundPlugins(org.apache.maven.lifecycle.LifecycleExecutor life,
org.apache.maven.project.MavenProject project,
String thePhases)
Gets the plugins that are bound to the defined phases.
|
String |
getPhases() |
Map<String,org.apache.maven.lifecycle.Lifecycle> |
getPhaseToLifecycleMap()
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.
|
List |
getUnCheckedPlugins() |
protected EnforcerRuleUtils |
getUtils()
Gets the utils.
|
protected boolean |
hasValidVersionSpecified(EnforcerRuleHelper helper,
org.apache.maven.model.Plugin source,
List<PluginWrapper> pluginWrappers)
Checks for valid version specified.
|
protected boolean |
isBanLatest()
Checks if is ban latest.
|
protected boolean |
isBanRelease()
Checks if is ban release.
|
boolean |
isBanSnapshots()
Checks if is ban snapshots.
|
boolean |
isBanTimestamps()
Checks if is ban timestamps.
|
protected boolean |
isSnapshot(String baseVersion)
Checks if is snapshot.
|
protected org.apache.maven.model.Plugin |
parsePluginString(String pluginString,
String field)
Helper method to parse and inject a Plugin.
|
Collection<org.apache.maven.model.Plugin> |
removeUncheckedPlugins(Collection<String> uncheckedPlugins,
Collection<org.apache.maven.model.Plugin> plugins)
Remove the plugins that the user doesn't want to check.
|
protected org.apache.maven.model.Plugin |
resolvePlugin(org.apache.maven.model.Plugin plugin,
org.apache.maven.project.MavenProject project)
Resolve plugin.
|
void |
setAdditionalPlugins(List<String> additionalPlugins) |
protected void |
setBanLatest(boolean theBanLatest)
Sets the ban latest.
|
protected 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 |
setPhases(String phases) |
void |
setUnCheckedPlugins(List unCheckedPlugins) |
protected void |
setUtils(EnforcerRuleUtils theUtils)
Sets the utils.
|
getCacheId, isCacheable, isResultValid
getLevel, getMessage, setLevel, setMessage
public RequirePluginVersions()
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRule
helper
- 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.EnforcerRuleException
- the enforcer rule exceptionpublic Collection<org.apache.maven.model.Plugin> removeUncheckedPlugins(Collection<String> uncheckedPlugins, Collection<org.apache.maven.model.Plugin> plugins) throws org.apache.maven.plugin.MojoExecutionException
uncheckedPlugins
- plugins
- org.apache.maven.plugin.MojoExecutionException
public Collection<String> combineUncheckedPlugins(Collection<String> uncheckedPlugins, String uncheckedPluginsList)
uncheckedPlugins
- uncheckedPluginsList
- public Set<org.apache.maven.model.Plugin> addAdditionalPlugins(Set<org.apache.maven.model.Plugin> existing, List<String> additional) throws org.apache.maven.plugin.MojoExecutionException
existing
- the existingadditional
- the additionalorg.apache.maven.plugin.MojoExecutionException
- the mojo execution exceptionprotected org.apache.maven.model.Plugin parsePluginString(String pluginString, String field) throws org.apache.maven.plugin.MojoExecutionException
pluginString
- field
- org.apache.maven.plugin.MojoExecutionException
public Set<org.apache.maven.model.Plugin> getProfilePlugins(org.apache.maven.project.MavenProject project)
project
- the projectprotected org.apache.maven.model.Plugin findCurrentPlugin(org.apache.maven.model.Plugin plugin, org.apache.maven.project.MavenProject project)
plugin
- plugin to lookupproject
- project to searchnull
if not found.protected org.apache.maven.model.Plugin resolvePlugin(org.apache.maven.model.Plugin plugin, org.apache.maven.project.MavenProject project)
plugin
- the pluginproject
- the projectprotected Set<org.apache.maven.model.Plugin> getBoundPlugins(org.apache.maven.lifecycle.LifecycleExecutor life, org.apache.maven.project.MavenProject project, String thePhases) throws org.apache.maven.plugin.PluginNotFoundException, org.apache.maven.lifecycle.LifecycleExecutionException, IllegalAccessException
life
- the lifeproject
- the projectthePhases
- the the phasesorg.apache.maven.plugin.PluginNotFoundException
- the plugin not found exceptionorg.apache.maven.lifecycle.LifecycleExecutionException
- the lifecycle execution exceptionIllegalAccessException
- the illegal access exceptionprotected boolean hasValidVersionSpecified(EnforcerRuleHelper helper, org.apache.maven.model.Plugin source, List<PluginWrapper> pluginWrappers)
helper
- the helpersource
- the sourcepluginWrappers
- the pluginsprotected boolean isSnapshot(String baseVersion)
baseVersion
- the base versionpublic Map<String,org.apache.maven.lifecycle.Lifecycle> getPhaseToLifecycleMap() throws org.apache.maven.lifecycle.LifecycleExecutionException
org.apache.maven.lifecycle.LifecycleExecutionException
- the lifecycle execution exceptionprotected List<PluginWrapper> getAllPluginEntries(org.apache.maven.project.MavenProject project) throws org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException, IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
project
- the projectorg.apache.maven.artifact.resolver.ArtifactResolutionException
- the artifact resolution exceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundException
- the artifact not found exceptionIOException
- Signals that an I/O exception has occurred.org.codehaus.plexus.util.xml.pull.XmlPullParserException
- the xml pull parser exceptionprotected boolean isBanLatest()
protected void setBanLatest(boolean theBanLatest)
theBanLatest
- the banLatest to setprotected boolean isBanRelease()
protected void setBanRelease(boolean theBanRelease)
theBanRelease
- the banRelease to setprotected EnforcerRuleUtils getUtils()
protected void setUtils(EnforcerRuleUtils theUtils)
theUtils
- the utils to setpublic boolean isBanSnapshots()
public void setBanSnapshots(boolean theBanSnapshots)
theBanSnapshots
- the banSnapshots to setpublic boolean isBanTimestamps()
public void setBanTimestamps(boolean theBanTimestamps)
theBanTimestamps
- the banTimestamps to setpublic List getUnCheckedPlugins()
public void setUnCheckedPlugins(List unCheckedPlugins)
public final void setAdditionalPlugins(List<String> additionalPlugins)
public final List<String> getAdditionalPlugins()
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.