| 1 | |
package org.apache.maven.plugins.enforcer; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
import java.io.File; |
| 23 | |
import java.io.IOException; |
| 24 | |
import java.lang.reflect.Field; |
| 25 | |
import java.util.ArrayList; |
| 26 | |
import java.util.Arrays; |
| 27 | |
import java.util.Collection; |
| 28 | |
import java.util.Collections; |
| 29 | |
import java.util.HashMap; |
| 30 | |
import java.util.HashSet; |
| 31 | |
import java.util.Iterator; |
| 32 | |
import java.util.List; |
| 33 | |
import java.util.Map; |
| 34 | |
import java.util.Set; |
| 35 | |
import java.util.Map.Entry; |
| 36 | |
|
| 37 | |
import org.apache.maven.BuildFailureException; |
| 38 | |
import org.apache.maven.artifact.Artifact; |
| 39 | |
import org.apache.maven.artifact.factory.ArtifactFactory; |
| 40 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
| 41 | |
import org.apache.maven.artifact.resolver.ArtifactNotFoundException; |
| 42 | |
import org.apache.maven.artifact.resolver.ArtifactResolutionException; |
| 43 | |
import org.apache.maven.artifact.resolver.ArtifactResolver; |
| 44 | |
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; |
| 45 | |
import org.apache.maven.artifact.versioning.VersionRange; |
| 46 | |
import org.apache.maven.enforcer.rule.api.EnforcerRuleException; |
| 47 | |
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper; |
| 48 | |
import org.apache.maven.execution.MavenSession; |
| 49 | |
import org.apache.maven.lifecycle.Lifecycle; |
| 50 | |
import org.apache.maven.lifecycle.LifecycleExecutionException; |
| 51 | |
import org.apache.maven.lifecycle.LifecycleExecutor; |
| 52 | |
import org.apache.maven.lifecycle.mapping.LifecycleMapping; |
| 53 | |
import org.apache.maven.model.BuildBase; |
| 54 | |
import org.apache.maven.model.Model; |
| 55 | |
import org.apache.maven.model.Plugin; |
| 56 | |
import org.apache.maven.model.Profile; |
| 57 | |
import org.apache.maven.plugin.InvalidPluginException; |
| 58 | |
import org.apache.maven.plugin.MojoExecutionException; |
| 59 | |
import org.apache.maven.plugin.PluginManager; |
| 60 | |
import org.apache.maven.plugin.PluginManagerException; |
| 61 | |
import org.apache.maven.plugin.PluginNotFoundException; |
| 62 | |
import org.apache.maven.plugin.descriptor.PluginDescriptor; |
| 63 | |
import org.apache.maven.plugin.logging.Log; |
| 64 | |
import org.apache.maven.plugin.version.PluginVersionNotFoundException; |
| 65 | |
import org.apache.maven.plugin.version.PluginVersionResolutionException; |
| 66 | |
import org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtils; |
| 67 | |
import org.apache.maven.plugins.enforcer.utils.PluginWrapper; |
| 68 | |
import org.apache.maven.project.MavenProject; |
| 69 | |
import org.apache.maven.settings.Settings; |
| 70 | |
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; |
| 71 | |
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; |
| 72 | |
import org.codehaus.plexus.util.ReflectionUtils; |
| 73 | |
import org.codehaus.plexus.util.StringUtils; |
| 74 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | 15 | public class RequirePluginVersions |
| 83 | |
extends AbstractNonCacheableEnforcerRule |
| 84 | |
{ |
| 85 | |
|
| 86 | |
|
| 87 | 15 | public boolean banLatest = true; |
| 88 | |
|
| 89 | |
|
| 90 | 15 | public boolean banRelease = true; |
| 91 | |
|
| 92 | |
|
| 93 | 15 | public boolean banSnapshots = true; |
| 94 | |
|
| 95 | |
|
| 96 | 15 | public boolean banTimestamps = true; |
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | 15 | public String phases = "clean,deploy,site"; |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
public List<String> additionalPlugins; |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
public List unCheckedPlugins; |
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | |
public String unCheckedPluginList; |
| 124 | |
|
| 125 | |
|
| 126 | |
private PluginManager pluginManager; |
| 127 | |
|
| 128 | |
|
| 129 | |
private Map<String, Lifecycle> phaseToLifecycleMap; |
| 130 | |
|
| 131 | |
|
| 132 | |
private Collection<Lifecycle> lifecycles; |
| 133 | |
|
| 134 | |
|
| 135 | |
ArtifactFactory factory; |
| 136 | |
|
| 137 | |
|
| 138 | |
ArtifactResolver resolver; |
| 139 | |
|
| 140 | |
|
| 141 | |
ArtifactRepository local; |
| 142 | |
|
| 143 | |
|
| 144 | |
List<ArtifactRepository> remoteRepositories; |
| 145 | |
|
| 146 | |
|
| 147 | |
Log log; |
| 148 | |
|
| 149 | |
|
| 150 | |
MavenSession session; |
| 151 | |
|
| 152 | |
|
| 153 | |
EnforcerRuleUtils utils; |
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
public void execute( EnforcerRuleHelper helper ) |
| 161 | |
throws EnforcerRuleException |
| 162 | |
{ |
| 163 | 0 | log = helper.getLog(); |
| 164 | |
|
| 165 | |
MavenProject project; |
| 166 | |
try |
| 167 | |
{ |
| 168 | |
|
| 169 | |
|
| 170 | 0 | project = (MavenProject) helper.evaluate( "${project}" ); |
| 171 | |
LifecycleExecutor life; |
| 172 | 0 | life = (LifecycleExecutor) helper.getComponent( LifecycleExecutor.class ); |
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | 0 | Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( "defaultLifeCycles", life.getClass() ); |
| 177 | 0 | if ( field != null ) |
| 178 | |
{ |
| 179 | 0 | Object defaultLifeCycles = ReflectionUtils.getValueIncludingSuperclasses( "defaultLifeCycles", life ); |
| 180 | 0 | Map lifecyclesMap = |
| 181 | |
(Map) ReflectionUtils.getValueIncludingSuperclasses( "lifecycles", defaultLifeCycles ); |
| 182 | 0 | lifecycles = lifecyclesMap.values(); |
| 183 | 0 | } |
| 184 | |
else |
| 185 | |
{ |
| 186 | 0 | lifecycles = (Collection) ReflectionUtils.getValueIncludingSuperclasses( "lifecycles", life ); |
| 187 | |
} |
| 188 | |
|
| 189 | 0 | session = (MavenSession) helper.evaluate( "${session}" ); |
| 190 | 0 | pluginManager = (PluginManager) helper.getComponent( PluginManager.class ); |
| 191 | 0 | factory = (ArtifactFactory) helper.getComponent( ArtifactFactory.class ); |
| 192 | 0 | resolver = (ArtifactResolver) helper.getComponent( ArtifactResolver.class ); |
| 193 | 0 | local = (ArtifactRepository) helper.evaluate( "${localRepository}" ); |
| 194 | 0 | remoteRepositories = project.getRemoteArtifactRepositories(); |
| 195 | |
|
| 196 | 0 | utils = new EnforcerRuleUtils( helper ); |
| 197 | |
|
| 198 | |
|
| 199 | 0 | Set<Plugin> allPlugins = getBoundPlugins( life, project, phases ); |
| 200 | |
|
| 201 | |
|
| 202 | 0 | allPlugins = addAdditionalPlugins( allPlugins, additionalPlugins ); |
| 203 | 0 | allPlugins.addAll( getProfilePlugins( project ) ); |
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | 0 | allPlugins = |
| 208 | |
(Set) removeUncheckedPlugins( combineUncheckedPlugins( unCheckedPlugins, unCheckedPluginList ), |
| 209 | |
allPlugins ); |
| 210 | |
|
| 211 | |
|
| 212 | 0 | if ( allPlugins.isEmpty() ) |
| 213 | |
{ |
| 214 | 0 | log.info( "No plugin bindings found." ); |
| 215 | 0 | return; |
| 216 | |
} |
| 217 | |
else |
| 218 | |
{ |
| 219 | 0 | log.debug( "All Plugins in use: " + allPlugins ); |
| 220 | |
} |
| 221 | |
|
| 222 | |
|
| 223 | 0 | List<PluginWrapper> pluginWrappers = getAllPluginEntries( project ); |
| 224 | |
|
| 225 | |
|
| 226 | 0 | List<Plugin> failures = new ArrayList<Plugin>(); |
| 227 | 0 | for ( Plugin plugin : allPlugins ) |
| 228 | |
{ |
| 229 | 0 | if ( !hasValidVersionSpecified( helper, plugin, pluginWrappers ) ) |
| 230 | |
{ |
| 231 | 0 | failures.add( plugin ); |
| 232 | |
} |
| 233 | |
} |
| 234 | |
|
| 235 | |
|
| 236 | 0 | if ( !failures.isEmpty() ) |
| 237 | |
{ |
| 238 | 0 | StringBuilder newMsg = new StringBuilder(); |
| 239 | 0 | newMsg.append( "Some plugins are missing valid versions:" ); |
| 240 | 0 | if ( banLatest || banRelease || banSnapshots || banTimestamps ) |
| 241 | |
{ |
| 242 | 0 | newMsg.append( "(" ); |
| 243 | 0 | if ( banLatest ) |
| 244 | |
{ |
| 245 | 0 | newMsg.append( "LATEST " ); |
| 246 | |
} |
| 247 | 0 | if ( banRelease ) |
| 248 | |
{ |
| 249 | 0 | newMsg.append( "RELEASE " ); |
| 250 | |
} |
| 251 | 0 | if ( banSnapshots || banTimestamps ) |
| 252 | |
{ |
| 253 | 0 | newMsg.append( "SNAPSHOT " ); |
| 254 | |
} |
| 255 | 0 | newMsg.append( "are not allowed )\n" ); |
| 256 | |
} |
| 257 | 0 | for ( Plugin plugin : failures ) |
| 258 | |
{ |
| 259 | 0 | newMsg.append( plugin.getGroupId() ); |
| 260 | 0 | newMsg.append( ":" ); |
| 261 | 0 | newMsg.append( plugin.getArtifactId() ); |
| 262 | |
|
| 263 | |
try |
| 264 | |
{ |
| 265 | 0 | newMsg.append( ". \tThe version currently in use is " ); |
| 266 | |
|
| 267 | 0 | Plugin currentPlugin = findCurrentPlugin( plugin, project ); |
| 268 | |
|
| 269 | 0 | if ( currentPlugin != null ) |
| 270 | |
{ |
| 271 | 0 | newMsg.append( currentPlugin.getVersion() ); |
| 272 | |
} |
| 273 | |
else |
| 274 | |
{ |
| 275 | 0 | newMsg.append( "unknown" ); |
| 276 | |
} |
| 277 | |
} |
| 278 | 0 | catch ( Exception e ) |
| 279 | |
{ |
| 280 | |
|
| 281 | |
|
| 282 | 0 | log.debug( "Exception while determining plugin Version.", e ); |
| 283 | 0 | newMsg.append( ". Unable to determine the plugin version." ); |
| 284 | 0 | } |
| 285 | 0 | newMsg.append( "\n" ); |
| 286 | |
} |
| 287 | 0 | if ( StringUtils.isNotEmpty( message ) ) |
| 288 | |
{ |
| 289 | 0 | newMsg.append( message ); |
| 290 | |
} |
| 291 | |
|
| 292 | 0 | throw new EnforcerRuleException( newMsg.toString() ); |
| 293 | |
} |
| 294 | |
} |
| 295 | 0 | catch ( ExpressionEvaluationException e ) |
| 296 | |
{ |
| 297 | 0 | throw new EnforcerRuleException( "Unable to Evaluate an Expression:" + e.getLocalizedMessage() ); |
| 298 | |
} |
| 299 | 0 | catch ( ComponentLookupException e ) |
| 300 | |
{ |
| 301 | 0 | throw new EnforcerRuleException( "Unable to lookup a component:" + e.getLocalizedMessage() ); |
| 302 | |
} |
| 303 | 0 | catch ( IllegalAccessException e ) |
| 304 | |
{ |
| 305 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 306 | |
} |
| 307 | 0 | catch ( LifecycleExecutionException e ) |
| 308 | |
{ |
| 309 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 310 | |
} |
| 311 | 0 | catch ( PluginNotFoundException e ) |
| 312 | |
{ |
| 313 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 314 | |
} |
| 315 | 0 | catch ( ArtifactResolutionException e ) |
| 316 | |
{ |
| 317 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 318 | |
} |
| 319 | 0 | catch ( ArtifactNotFoundException e ) |
| 320 | |
{ |
| 321 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 322 | |
} |
| 323 | 0 | catch ( IOException e ) |
| 324 | |
{ |
| 325 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 326 | |
} |
| 327 | 0 | catch ( XmlPullParserException e ) |
| 328 | |
{ |
| 329 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 330 | |
} |
| 331 | 0 | catch ( MojoExecutionException e ) |
| 332 | |
{ |
| 333 | 0 | throw new EnforcerRuleException( e.getLocalizedMessage() ); |
| 334 | 0 | } |
| 335 | 0 | } |
| 336 | |
|
| 337 | |
|
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
|
| 344 | |
|
| 345 | |
public Collection<Plugin> removeUncheckedPlugins( Collection<String> uncheckedPlugins, Collection<Plugin> plugins ) |
| 346 | |
throws MojoExecutionException |
| 347 | |
{ |
| 348 | 1 | if ( uncheckedPlugins != null && !uncheckedPlugins.isEmpty() ) |
| 349 | |
{ |
| 350 | 1 | for ( String pluginKey : uncheckedPlugins ) |
| 351 | |
{ |
| 352 | 1 | Plugin plugin = parsePluginString( pluginKey, "UncheckedPlugins" ); |
| 353 | 1 | plugins.remove( plugin ); |
| 354 | 1 | } |
| 355 | |
} |
| 356 | 1 | return plugins; |
| 357 | |
} |
| 358 | |
|
| 359 | |
|
| 360 | |
|
| 361 | |
|
| 362 | |
|
| 363 | |
|
| 364 | |
|
| 365 | |
public Collection<String> combineUncheckedPlugins( Collection<String> uncheckedPlugins, String uncheckedPluginsList ) |
| 366 | |
{ |
| 367 | |
|
| 368 | 6 | if ( StringUtils.isNotEmpty( uncheckedPluginsList ) ) |
| 369 | |
{ |
| 370 | |
|
| 371 | 4 | if ( uncheckedPlugins == null ) |
| 372 | |
{ |
| 373 | 1 | uncheckedPlugins = new HashSet<String>(); |
| 374 | |
} |
| 375 | 3 | else if ( !uncheckedPlugins.isEmpty() && log != null ) |
| 376 | |
{ |
| 377 | 0 | log.warn( "The parameter 'unCheckedPlugins' is deprecated. Use 'unCheckedPluginList' instead" ); |
| 378 | |
} |
| 379 | |
|
| 380 | 4 | uncheckedPlugins.addAll( Arrays.asList( uncheckedPluginsList.split( "," ) ) ); |
| 381 | |
} |
| 382 | 6 | return uncheckedPlugins; |
| 383 | |
} |
| 384 | |
|
| 385 | |
|
| 386 | |
|
| 387 | |
|
| 388 | |
|
| 389 | |
|
| 390 | |
|
| 391 | |
|
| 392 | |
|
| 393 | |
public Set<Plugin> addAdditionalPlugins( Set<Plugin> existing, List<String> additional ) |
| 394 | |
throws MojoExecutionException |
| 395 | |
{ |
| 396 | 5 | if ( additional != null ) |
| 397 | |
{ |
| 398 | 4 | for( String pluginString : additional ) |
| 399 | |
{ |
| 400 | 6 | Plugin plugin = parsePluginString( pluginString, "AdditionalPlugins" ); |
| 401 | |
|
| 402 | 4 | if ( existing == null ) |
| 403 | |
{ |
| 404 | 1 | existing = new HashSet<Plugin>(); |
| 405 | 1 | existing.add( plugin ); |
| 406 | |
} |
| 407 | 3 | else if ( !existing.contains( plugin ) ) |
| 408 | |
{ |
| 409 | 2 | existing.add( plugin ); |
| 410 | |
} |
| 411 | 4 | } |
| 412 | |
} |
| 413 | 3 | return existing; |
| 414 | |
} |
| 415 | |
|
| 416 | |
|
| 417 | |
|
| 418 | |
|
| 419 | |
|
| 420 | |
|
| 421 | |
|
| 422 | |
|
| 423 | |
protected Plugin parsePluginString( String pluginString, String field ) |
| 424 | |
throws MojoExecutionException |
| 425 | |
{ |
| 426 | 7 | if ( pluginString != null ) |
| 427 | |
{ |
| 428 | 7 | String[] pluginStrings = pluginString.split( ":" ); |
| 429 | 7 | if ( pluginStrings.length == 2 ) |
| 430 | |
{ |
| 431 | 5 | Plugin plugin = new Plugin(); |
| 432 | 5 | plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) ); |
| 433 | 5 | plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) ); |
| 434 | |
|
| 435 | 5 | return plugin; |
| 436 | |
} |
| 437 | |
else |
| 438 | |
{ |
| 439 | 2 | throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); |
| 440 | |
} |
| 441 | |
} |
| 442 | |
else |
| 443 | |
{ |
| 444 | 0 | throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); |
| 445 | |
} |
| 446 | |
|
| 447 | |
} |
| 448 | |
|
| 449 | |
|
| 450 | |
|
| 451 | |
|
| 452 | |
|
| 453 | |
|
| 454 | |
|
| 455 | |
public Set<Plugin> getProfilePlugins( MavenProject project ) |
| 456 | |
{ |
| 457 | 0 | Set<Plugin> result = new HashSet<Plugin>(); |
| 458 | |
@SuppressWarnings( "unchecked" ) |
| 459 | 0 | List<Profile> profiles = project.getActiveProfiles(); |
| 460 | 0 | if ( profiles != null && !profiles.isEmpty() ) |
| 461 | |
{ |
| 462 | 0 | for ( Profile p : profiles ) |
| 463 | |
{ |
| 464 | 0 | BuildBase b = p.getBuild(); |
| 465 | 0 | if ( b != null ) |
| 466 | |
{ |
| 467 | |
@SuppressWarnings( "unchecked" ) |
| 468 | 0 | List<Plugin> plugins = b.getPlugins(); |
| 469 | 0 | if ( plugins != null ) |
| 470 | |
{ |
| 471 | 0 | result.addAll( plugins ); |
| 472 | |
} |
| 473 | |
} |
| 474 | 0 | } |
| 475 | |
} |
| 476 | 0 | return result; |
| 477 | |
} |
| 478 | |
|
| 479 | |
|
| 480 | |
|
| 481 | |
|
| 482 | |
|
| 483 | |
|
| 484 | |
|
| 485 | |
|
| 486 | |
protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project ) |
| 487 | |
{ |
| 488 | 0 | Plugin found = null; |
| 489 | |
try |
| 490 | |
{ |
| 491 | 0 | Model model = project.getModel(); |
| 492 | |
@SuppressWarnings( "unchecked" ) |
| 493 | 0 | Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap(); |
| 494 | 0 | found = plugins.get( plugin.getKey() ); |
| 495 | |
} |
| 496 | 0 | catch ( NullPointerException e ) |
| 497 | |
{ |
| 498 | |
|
| 499 | 0 | } |
| 500 | |
|
| 501 | 0 | if ( found == null ) |
| 502 | |
{ |
| 503 | 0 | found = resolvePlugin( plugin, project ); |
| 504 | |
} |
| 505 | |
|
| 506 | 0 | return found; |
| 507 | |
} |
| 508 | |
|
| 509 | |
|
| 510 | |
|
| 511 | |
|
| 512 | |
|
| 513 | |
|
| 514 | |
|
| 515 | |
|
| 516 | |
protected Plugin resolvePlugin( Plugin plugin, MavenProject project ) |
| 517 | |
{ |
| 518 | |
|
| 519 | |
@SuppressWarnings( "unchecked" ) |
| 520 | 0 | List<ArtifactRepository> pluginRepositories = project.getPluginArtifactRepositories(); |
| 521 | 0 | Artifact artifact = |
| 522 | |
factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), |
| 523 | |
VersionRange.createFromVersion( "LATEST" ) ); |
| 524 | |
|
| 525 | |
try |
| 526 | |
{ |
| 527 | 0 | this.resolver.resolve( artifact, pluginRepositories, this.local ); |
| 528 | 0 | plugin.setVersion( artifact.getVersion() ); |
| 529 | |
} |
| 530 | 0 | catch ( ArtifactResolutionException e ) |
| 531 | |
{ |
| 532 | |
} |
| 533 | 0 | catch ( ArtifactNotFoundException e ) |
| 534 | |
{ |
| 535 | 0 | } |
| 536 | |
|
| 537 | 0 | return plugin; |
| 538 | |
} |
| 539 | |
|
| 540 | |
|
| 541 | |
|
| 542 | |
|
| 543 | |
|
| 544 | |
|
| 545 | |
|
| 546 | |
|
| 547 | |
|
| 548 | |
|
| 549 | |
|
| 550 | |
|
| 551 | |
|
| 552 | |
protected Set<Plugin> getBoundPlugins( LifecycleExecutor life, MavenProject project, String thePhases ) |
| 553 | |
throws PluginNotFoundException, LifecycleExecutionException, IllegalAccessException |
| 554 | |
{ |
| 555 | |
|
| 556 | 0 | Set<Plugin> allPlugins = new HashSet<Plugin>(); |
| 557 | |
|
| 558 | |
|
| 559 | 0 | String[] lifecyclePhases = thePhases.split( "," ); |
| 560 | 0 | for ( int i = 0; i < lifecyclePhases.length; i++ ) |
| 561 | |
{ |
| 562 | 0 | String lifecyclePhase = lifecyclePhases[i]; |
| 563 | 0 | if ( StringUtils.isNotEmpty( lifecyclePhase ) ) |
| 564 | |
{ |
| 565 | |
try |
| 566 | |
{ |
| 567 | 0 | Lifecycle lifecycle = getLifecycleForPhase( lifecyclePhase ); |
| 568 | 0 | allPlugins.addAll( getAllPlugins( project, lifecycle ) ); |
| 569 | |
} |
| 570 | 0 | catch ( BuildFailureException e ) |
| 571 | |
{ |
| 572 | |
|
| 573 | |
|
| 574 | |
|
| 575 | 0 | } |
| 576 | |
} |
| 577 | |
} |
| 578 | 0 | return allPlugins; |
| 579 | |
} |
| 580 | |
|
| 581 | |
|
| 582 | |
|
| 583 | |
|
| 584 | |
|
| 585 | |
|
| 586 | |
|
| 587 | |
|
| 588 | |
|
| 589 | |
|
| 590 | |
|
| 591 | |
|
| 592 | |
|
| 593 | |
protected boolean hasValidVersionSpecified( EnforcerRuleHelper helper, Plugin source, List<PluginWrapper> pluginWrappers ) |
| 594 | |
{ |
| 595 | 19 | boolean found = false; |
| 596 | 19 | boolean status = false; |
| 597 | 19 | for ( PluginWrapper plugin : pluginWrappers ) |
| 598 | |
{ |
| 599 | |
|
| 600 | 129 | if ( source.getArtifactId().equals( plugin.getArtifactId() ) |
| 601 | |
&& source.getGroupId().equals( plugin.getGroupId() ) ) |
| 602 | |
{ |
| 603 | 26 | found = true; |
| 604 | |
|
| 605 | 26 | String version = plugin.getVersion(); |
| 606 | |
try |
| 607 | |
{ |
| 608 | 26 | version = (String) helper.evaluate( version ); |
| 609 | |
} |
| 610 | 0 | catch ( ExpressionEvaluationException e ) |
| 611 | |
{ |
| 612 | 0 | return false; |
| 613 | 26 | } |
| 614 | |
|
| 615 | 26 | if ( StringUtils.isNotEmpty( version ) && !StringUtils.isWhitespace( version ) ) |
| 616 | |
{ |
| 617 | |
|
| 618 | 22 | if ( banRelease && version.equals( "RELEASE" ) ) |
| 619 | |
{ |
| 620 | 3 | return false; |
| 621 | |
} |
| 622 | |
|
| 623 | 19 | if ( banLatest && version.equals( "LATEST" ) ) |
| 624 | |
{ |
| 625 | 3 | return false; |
| 626 | |
} |
| 627 | |
|
| 628 | 16 | if ( banSnapshots && isSnapshot( version ) ) |
| 629 | |
{ |
| 630 | 2 | return false; |
| 631 | |
} |
| 632 | |
|
| 633 | |
|
| 634 | |
|
| 635 | |
|
| 636 | 14 | status = true; |
| 637 | |
|
| 638 | 14 | if ( !banRelease && !banLatest && !banSnapshots ) |
| 639 | |
{ |
| 640 | |
|
| 641 | 6 | break; |
| 642 | |
} |
| 643 | |
} |
| 644 | 115 | } |
| 645 | |
} |
| 646 | 11 | if ( !found ) |
| 647 | |
{ |
| 648 | 0 | log.debug( "plugin " + source.getGroupId() + ":" + source.getArtifactId() + " not found" ); |
| 649 | |
} |
| 650 | 11 | return status; |
| 651 | |
} |
| 652 | |
|
| 653 | |
|
| 654 | |
|
| 655 | |
|
| 656 | |
|
| 657 | |
|
| 658 | |
|
| 659 | |
protected boolean isSnapshot( String baseVersion ) |
| 660 | |
{ |
| 661 | 9 | if ( banTimestamps ) |
| 662 | |
{ |
| 663 | 5 | return Artifact.VERSION_FILE_PATTERN.matcher( baseVersion ).matches() |
| 664 | |
|| baseVersion.endsWith( Artifact.SNAPSHOT_VERSION ); |
| 665 | |
} |
| 666 | |
else |
| 667 | |
{ |
| 668 | 4 | return baseVersion.endsWith( Artifact.SNAPSHOT_VERSION ); |
| 669 | |
} |
| 670 | |
} |
| 671 | |
|
| 672 | |
|
| 673 | |
|
| 674 | |
|
| 675 | |
|
| 676 | |
|
| 677 | |
|
| 678 | |
|
| 679 | |
|
| 680 | |
|
| 681 | |
|
| 682 | |
|
| 683 | |
|
| 684 | |
@SuppressWarnings( "unchecked" ) |
| 685 | |
private Set<Plugin> getAllPlugins( MavenProject project, Lifecycle lifecycle ) |
| 686 | |
throws PluginNotFoundException, LifecycleExecutionException |
| 687 | |
|
| 688 | |
{ |
| 689 | 0 | log.debug( "RequirePluginVersions.getAllPlugins:" ); |
| 690 | |
|
| 691 | 0 | Set<Plugin> plugins = new HashSet<Plugin>(); |
| 692 | |
|
| 693 | 0 | Map mappings = findMappingsForLifecycle( project, lifecycle ); |
| 694 | |
|
| 695 | 0 | Iterator iter = mappings.entrySet().iterator(); |
| 696 | 0 | while ( iter.hasNext() ) |
| 697 | |
{ |
| 698 | 0 | Entry entry = (Entry) iter.next(); |
| 699 | 0 | log.debug( " lifecycleMapping = " + entry.getKey() ); |
| 700 | 0 | String pluginsForLifecycle = (String) entry.getValue(); |
| 701 | 0 | log.debug( " plugins = " + pluginsForLifecycle ); |
| 702 | 0 | if ( StringUtils.isNotEmpty( pluginsForLifecycle ) ) |
| 703 | |
{ |
| 704 | 0 | String pluginList[] = pluginsForLifecycle.split( "," ); |
| 705 | 0 | for ( String plugin : pluginList ) |
| 706 | |
{ |
| 707 | 0 | plugin = StringUtils.strip( plugin ); |
| 708 | 0 | log.debug( " plugin = " + plugin ); |
| 709 | 0 | String tokens[] = plugin.split( ":" ); |
| 710 | 0 | log.debug( " GAV = " + Arrays.asList( tokens ) ); |
| 711 | |
|
| 712 | 0 | Plugin p = new Plugin(); |
| 713 | 0 | p.setGroupId( tokens[0] ); |
| 714 | 0 | p.setArtifactId( tokens[1] ); |
| 715 | 0 | plugins.add( p ); |
| 716 | |
} |
| 717 | |
} |
| 718 | 0 | } |
| 719 | |
|
| 720 | 0 | List<String> mojos = findOptionalMojosForLifecycle( project, lifecycle ); |
| 721 | 0 | for ( String value : mojos ) |
| 722 | |
{ |
| 723 | 0 | String tokens[] = value.split( ":" ); |
| 724 | |
|
| 725 | 0 | Plugin plugin = new Plugin(); |
| 726 | 0 | plugin.setGroupId( tokens[0] ); |
| 727 | 0 | plugin.setArtifactId( tokens[1] ); |
| 728 | 0 | plugins.add( plugin ); |
| 729 | 0 | } |
| 730 | |
|
| 731 | 0 | plugins.addAll( project.getBuildPlugins() ); |
| 732 | |
|
| 733 | 0 | return plugins; |
| 734 | |
} |
| 735 | |
|
| 736 | |
|
| 737 | |
|
| 738 | |
|
| 739 | |
|
| 740 | |
|
| 741 | |
|
| 742 | |
|
| 743 | |
|
| 744 | |
|
| 745 | |
|
| 746 | |
public Map<String, Lifecycle> getPhaseToLifecycleMap() |
| 747 | |
throws LifecycleExecutionException |
| 748 | |
{ |
| 749 | 0 | if ( phaseToLifecycleMap == null ) |
| 750 | |
{ |
| 751 | 0 | phaseToLifecycleMap = new HashMap<String, Lifecycle>(); |
| 752 | |
|
| 753 | 0 | for ( Lifecycle lifecycle : lifecycles ) |
| 754 | |
{ |
| 755 | |
@SuppressWarnings( "unchecked" ) |
| 756 | 0 | List<String> phases = lifecycle.getPhases(); |
| 757 | 0 | for ( String phase : phases ) |
| 758 | |
{ |
| 759 | 0 | if ( phaseToLifecycleMap.containsKey( phase ) ) |
| 760 | |
{ |
| 761 | 0 | Lifecycle prevLifecycle = (Lifecycle) phaseToLifecycleMap.get( phase ); |
| 762 | 0 | throw new LifecycleExecutionException( "Phase '" + phase |
| 763 | |
+ "' is defined in more than one lifecycle: '" + lifecycle.getId() + "' and '" |
| 764 | |
+ prevLifecycle.getId() + "'" ); |
| 765 | |
} |
| 766 | |
else |
| 767 | |
{ |
| 768 | 0 | phaseToLifecycleMap.put( phase, lifecycle ); |
| 769 | |
} |
| 770 | |
} |
| 771 | 0 | } |
| 772 | |
} |
| 773 | 0 | return phaseToLifecycleMap; |
| 774 | |
} |
| 775 | |
|
| 776 | |
|
| 777 | |
|
| 778 | |
|
| 779 | |
|
| 780 | |
|
| 781 | |
|
| 782 | |
|
| 783 | |
|
| 784 | |
private Lifecycle getLifecycleForPhase( String phase ) |
| 785 | |
throws BuildFailureException, LifecycleExecutionException |
| 786 | |
{ |
| 787 | 0 | Lifecycle lifecycle = (Lifecycle) getPhaseToLifecycleMap().get( phase ); |
| 788 | |
|
| 789 | 0 | if ( lifecycle == null ) |
| 790 | |
{ |
| 791 | 0 | throw new BuildFailureException( "Unable to find lifecycle for phase '" + phase + "'" ); |
| 792 | |
} |
| 793 | 0 | return lifecycle; |
| 794 | |
} |
| 795 | |
|
| 796 | |
|
| 797 | |
|
| 798 | |
|
| 799 | |
|
| 800 | |
|
| 801 | |
|
| 802 | |
|
| 803 | |
|
| 804 | |
|
| 805 | |
private Map findMappingsForLifecycle( MavenProject project, Lifecycle lifecycle ) |
| 806 | |
throws LifecycleExecutionException, PluginNotFoundException |
| 807 | |
{ |
| 808 | 0 | String packaging = project.getPackaging(); |
| 809 | 0 | Map mappings = null; |
| 810 | |
|
| 811 | 0 | LifecycleMapping m = |
| 812 | |
(LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(), |
| 813 | |
session.getLocalRepository() ); |
| 814 | 0 | if ( m != null ) |
| 815 | |
{ |
| 816 | 0 | mappings = m.getPhases( lifecycle.getId() ); |
| 817 | |
} |
| 818 | |
|
| 819 | 0 | Map defaultMappings = lifecycle.getDefaultPhases(); |
| 820 | |
|
| 821 | 0 | if ( mappings == null ) |
| 822 | |
{ |
| 823 | |
try |
| 824 | |
{ |
| 825 | 0 | m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging ); |
| 826 | 0 | mappings = m.getPhases( lifecycle.getId() ); |
| 827 | |
} |
| 828 | 0 | catch ( ComponentLookupException e ) |
| 829 | |
{ |
| 830 | 0 | if ( defaultMappings == null ) |
| 831 | |
{ |
| 832 | 0 | throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" |
| 833 | |
+ packaging + "\'.", e ); |
| 834 | |
} |
| 835 | 0 | } |
| 836 | |
} |
| 837 | |
|
| 838 | 0 | if ( mappings == null ) |
| 839 | |
{ |
| 840 | 0 | if ( defaultMappings == null ) |
| 841 | |
{ |
| 842 | 0 | throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" + packaging |
| 843 | |
+ "\', and there is no default" ); |
| 844 | |
} |
| 845 | |
else |
| 846 | |
{ |
| 847 | 0 | mappings = defaultMappings; |
| 848 | |
} |
| 849 | |
} |
| 850 | |
|
| 851 | 0 | return mappings; |
| 852 | |
} |
| 853 | |
|
| 854 | |
|
| 855 | |
|
| 856 | |
|
| 857 | |
|
| 858 | |
|
| 859 | |
|
| 860 | |
|
| 861 | |
|
| 862 | |
|
| 863 | |
@SuppressWarnings( "unchecked" ) |
| 864 | |
private List<String> findOptionalMojosForLifecycle( MavenProject project, Lifecycle lifecycle ) |
| 865 | |
throws LifecycleExecutionException, PluginNotFoundException |
| 866 | |
{ |
| 867 | 0 | String packaging = project.getPackaging(); |
| 868 | 0 | List<String> optionalMojos = null; |
| 869 | |
|
| 870 | 0 | LifecycleMapping m = |
| 871 | |
(LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(), |
| 872 | |
session.getLocalRepository() ); |
| 873 | |
|
| 874 | 0 | if ( m != null ) |
| 875 | |
{ |
| 876 | 0 | optionalMojos = m.getOptionalMojos( lifecycle.getId() ); |
| 877 | |
} |
| 878 | |
|
| 879 | 0 | if ( optionalMojos == null ) |
| 880 | |
{ |
| 881 | |
try |
| 882 | |
{ |
| 883 | 0 | m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging ); |
| 884 | 0 | optionalMojos = m.getOptionalMojos( lifecycle.getId() ); |
| 885 | |
} |
| 886 | 0 | catch ( ComponentLookupException e ) |
| 887 | |
{ |
| 888 | 0 | log.debug( "Error looking up lifecycle mapping to retrieve optional mojos. Lifecycle ID: " |
| 889 | |
+ lifecycle.getId() + ". Error: " + e.getMessage(), e ); |
| 890 | 0 | } |
| 891 | |
} |
| 892 | |
|
| 893 | 0 | if ( optionalMojos == null ) |
| 894 | |
{ |
| 895 | 0 | optionalMojos = Collections.emptyList(); |
| 896 | |
} |
| 897 | |
|
| 898 | 0 | return optionalMojos; |
| 899 | |
} |
| 900 | |
|
| 901 | |
|
| 902 | |
|
| 903 | |
|
| 904 | |
|
| 905 | |
|
| 906 | |
|
| 907 | |
|
| 908 | |
|
| 909 | |
|
| 910 | |
|
| 911 | |
|
| 912 | |
|
| 913 | |
private Object findExtension( MavenProject project, String role, String roleHint, Settings settings, |
| 914 | |
ArtifactRepository localRepository ) |
| 915 | |
throws LifecycleExecutionException, PluginNotFoundException |
| 916 | |
{ |
| 917 | 0 | Object pluginComponent = null; |
| 918 | |
|
| 919 | |
@SuppressWarnings( "unchecked" ) |
| 920 | 0 | List<Plugin> buildPlugins = project.getBuildPlugins(); |
| 921 | 0 | for ( Plugin plugin : buildPlugins ) |
| 922 | |
{ |
| 923 | 0 | if ( plugin.isExtensions() ) |
| 924 | |
{ |
| 925 | 0 | verifyPlugin( plugin, project, settings, localRepository ); |
| 926 | |
|
| 927 | |
|
| 928 | |
|
| 929 | |
|
| 930 | |
|
| 931 | |
try |
| 932 | |
{ |
| 933 | 0 | pluginComponent = pluginManager.getPluginComponent( plugin, role, roleHint ); |
| 934 | |
|
| 935 | 0 | if ( pluginComponent != null ) |
| 936 | |
{ |
| 937 | 0 | break; |
| 938 | |
} |
| 939 | |
} |
| 940 | 0 | catch ( ComponentLookupException e ) |
| 941 | |
{ |
| 942 | 0 | log.debug( "Unable to find the lifecycle component in the extension", e ); |
| 943 | |
} |
| 944 | 0 | catch ( PluginManagerException e ) |
| 945 | |
{ |
| 946 | 0 | throw new LifecycleExecutionException( "Error getting extensions from the plugin '" |
| 947 | |
+ plugin.getKey() + "': " + e.getMessage(), e ); |
| 948 | 0 | } |
| 949 | |
} |
| 950 | |
} |
| 951 | 0 | return pluginComponent; |
| 952 | |
} |
| 953 | |
|
| 954 | |
|
| 955 | |
|
| 956 | |
|
| 957 | |
|
| 958 | |
|
| 959 | |
|
| 960 | |
|
| 961 | |
|
| 962 | |
|
| 963 | |
|
| 964 | |
|
| 965 | |
private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings, |
| 966 | |
ArtifactRepository localRepository ) |
| 967 | |
throws LifecycleExecutionException, PluginNotFoundException |
| 968 | |
{ |
| 969 | |
PluginDescriptor pluginDescriptor; |
| 970 | |
try |
| 971 | |
{ |
| 972 | 0 | pluginDescriptor = pluginManager.verifyPlugin( plugin, project, settings, localRepository ); |
| 973 | |
} |
| 974 | 0 | catch ( PluginManagerException e ) |
| 975 | |
{ |
| 976 | 0 | throw new LifecycleExecutionException( "Internal error in the plugin manager getting plugin '" |
| 977 | |
+ plugin.getKey() + "': " + e.getMessage(), e ); |
| 978 | |
} |
| 979 | 0 | catch ( PluginVersionResolutionException e ) |
| 980 | |
{ |
| 981 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 982 | |
} |
| 983 | 0 | catch ( InvalidVersionSpecificationException e ) |
| 984 | |
{ |
| 985 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 986 | |
} |
| 987 | 0 | catch ( InvalidPluginException e ) |
| 988 | |
{ |
| 989 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 990 | |
} |
| 991 | 0 | catch ( ArtifactNotFoundException e ) |
| 992 | |
{ |
| 993 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 994 | |
} |
| 995 | 0 | catch ( ArtifactResolutionException e ) |
| 996 | |
{ |
| 997 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 998 | |
} |
| 999 | 0 | catch ( PluginVersionNotFoundException e ) |
| 1000 | |
{ |
| 1001 | 0 | throw new LifecycleExecutionException( e.getMessage(), e ); |
| 1002 | 0 | } |
| 1003 | 0 | return pluginDescriptor; |
| 1004 | |
} |
| 1005 | |
|
| 1006 | |
|
| 1007 | |
|
| 1008 | |
|
| 1009 | |
|
| 1010 | |
|
| 1011 | |
|
| 1012 | |
|
| 1013 | |
|
| 1014 | |
|
| 1015 | |
|
| 1016 | |
|
| 1017 | |
protected List<PluginWrapper> getAllPluginEntries( MavenProject project ) |
| 1018 | |
throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException |
| 1019 | |
{ |
| 1020 | 1 | List<PluginWrapper> plugins = new ArrayList<PluginWrapper>(); |
| 1021 | |
|
| 1022 | |
|
| 1023 | 1 | String pomName = null; |
| 1024 | |
try |
| 1025 | |
{ |
| 1026 | 1 | pomName = project.getFile().getName(); |
| 1027 | |
} |
| 1028 | 1 | catch ( Exception e ) |
| 1029 | |
{ |
| 1030 | 1 | pomName = "pom.xml"; |
| 1031 | 0 | } |
| 1032 | 1 | List<Model> models = |
| 1033 | |
utils.getModelsRecursively( project.getGroupId(), project.getArtifactId(), project.getVersion(), |
| 1034 | |
new File( project.getBasedir(), pomName ) ); |
| 1035 | |
|
| 1036 | |
|
| 1037 | |
|
| 1038 | 1 | for ( Model model : models ) |
| 1039 | |
{ |
| 1040 | |
try |
| 1041 | |
{ |
| 1042 | 3 | plugins.addAll( PluginWrapper.addAll( model.getBuild().getPlugins(), model.getId() + ".build.plugins" ) ); |
| 1043 | |
} |
| 1044 | 1 | catch ( NullPointerException e ) |
| 1045 | |
{ |
| 1046 | |
|
| 1047 | 2 | } |
| 1048 | |
|
| 1049 | |
try |
| 1050 | |
{ |
| 1051 | |
|
| 1052 | 3 | plugins.addAll( PluginWrapper.addAll( model.getReporting().getPlugins(), model.getId() + ".reporting" ) ); |
| 1053 | |
} |
| 1054 | 3 | catch ( NullPointerException e ) |
| 1055 | |
{ |
| 1056 | |
|
| 1057 | 0 | } |
| 1058 | |
|
| 1059 | |
try |
| 1060 | |
{ |
| 1061 | 3 | plugins.addAll( PluginWrapper.addAll( model.getBuild().getPluginManagement().getPlugins(), |
| 1062 | |
model.getId() + ".build.pluginManagement.plugins" ) ); |
| 1063 | |
} |
| 1064 | 2 | catch ( NullPointerException e ) |
| 1065 | |
{ |
| 1066 | |
|
| 1067 | 1 | } |
| 1068 | |
|
| 1069 | |
|
| 1070 | |
@SuppressWarnings( "unchecked" ) |
| 1071 | 3 | List<Profile> profiles = model.getProfiles(); |
| 1072 | 3 | for ( Profile profile : profiles ) |
| 1073 | |
{ |
| 1074 | |
try |
| 1075 | |
{ |
| 1076 | 0 | plugins.addAll( PluginWrapper.addAll( profile.getBuild().getPlugins(), model.getId() |
| 1077 | |
+ ".profiles.profile[" + profile.getId() + "].build.plugins" ) ); |
| 1078 | |
} |
| 1079 | 0 | catch ( NullPointerException e ) |
| 1080 | |
{ |
| 1081 | |
|
| 1082 | 0 | } |
| 1083 | |
|
| 1084 | |
try |
| 1085 | |
{ |
| 1086 | |
|
| 1087 | 0 | plugins.addAll( PluginWrapper.addAll( profile.getReporting().getPlugins(), model.getId() |
| 1088 | |
+ "profile[" + profile.getId() + "].reporting.plugins" ) ); |
| 1089 | |
} |
| 1090 | 0 | catch ( NullPointerException e ) |
| 1091 | |
{ |
| 1092 | |
|
| 1093 | 0 | } |
| 1094 | |
try |
| 1095 | |
{ |
| 1096 | |
|
| 1097 | 0 | plugins.addAll( PluginWrapper.addAll( profile.getBuild().getPluginManagement().getPlugins(), |
| 1098 | |
model.getId() + "profile[" + profile.getId() |
| 1099 | |
+ "].build.pluginManagement.plugins" ) ); |
| 1100 | |
} |
| 1101 | 0 | catch ( NullPointerException e ) |
| 1102 | |
{ |
| 1103 | |
|
| 1104 | 0 | } |
| 1105 | |
} |
| 1106 | 3 | } |
| 1107 | |
|
| 1108 | 1 | return plugins; |
| 1109 | |
} |
| 1110 | |
|
| 1111 | |
|
| 1112 | |
|
| 1113 | |
|
| 1114 | |
|
| 1115 | |
|
| 1116 | |
protected boolean isBanLatest() |
| 1117 | |
{ |
| 1118 | 0 | return this.banLatest; |
| 1119 | |
} |
| 1120 | |
|
| 1121 | |
|
| 1122 | |
|
| 1123 | |
|
| 1124 | |
|
| 1125 | |
|
| 1126 | |
protected void setBanLatest( boolean theBanLatest ) |
| 1127 | |
{ |
| 1128 | 5 | this.banLatest = theBanLatest; |
| 1129 | 5 | } |
| 1130 | |
|
| 1131 | |
|
| 1132 | |
|
| 1133 | |
|
| 1134 | |
|
| 1135 | |
|
| 1136 | |
protected boolean isBanRelease() |
| 1137 | |
{ |
| 1138 | 0 | return this.banRelease; |
| 1139 | |
} |
| 1140 | |
|
| 1141 | |
|
| 1142 | |
|
| 1143 | |
|
| 1144 | |
|
| 1145 | |
|
| 1146 | |
protected void setBanRelease( boolean theBanRelease ) |
| 1147 | |
{ |
| 1148 | 4 | this.banRelease = theBanRelease; |
| 1149 | 4 | } |
| 1150 | |
|
| 1151 | |
|
| 1152 | |
|
| 1153 | |
|
| 1154 | |
|
| 1155 | |
|
| 1156 | |
protected String getMessage() |
| 1157 | |
{ |
| 1158 | 0 | return this.message; |
| 1159 | |
} |
| 1160 | |
|
| 1161 | |
|
| 1162 | |
|
| 1163 | |
|
| 1164 | |
|
| 1165 | |
|
| 1166 | |
protected void setMessage( String theMessage ) |
| 1167 | |
{ |
| 1168 | 0 | this.message = theMessage; |
| 1169 | 0 | } |
| 1170 | |
|
| 1171 | |
|
| 1172 | |
|
| 1173 | |
|
| 1174 | |
|
| 1175 | |
|
| 1176 | |
protected EnforcerRuleUtils getUtils() |
| 1177 | |
{ |
| 1178 | 0 | return this.utils; |
| 1179 | |
} |
| 1180 | |
|
| 1181 | |
|
| 1182 | |
|
| 1183 | |
|
| 1184 | |
|
| 1185 | |
|
| 1186 | |
protected void setUtils( EnforcerRuleUtils theUtils ) |
| 1187 | |
{ |
| 1188 | 1 | this.utils = theUtils; |
| 1189 | 1 | } |
| 1190 | |
|
| 1191 | |
|
| 1192 | |
|
| 1193 | |
|
| 1194 | |
|
| 1195 | |
|
| 1196 | |
public boolean isBanSnapshots() |
| 1197 | |
{ |
| 1198 | 0 | return this.banSnapshots; |
| 1199 | |
} |
| 1200 | |
|
| 1201 | |
|
| 1202 | |
|
| 1203 | |
|
| 1204 | |
|
| 1205 | |
|
| 1206 | |
public void setBanSnapshots( boolean theBanSnapshots ) |
| 1207 | |
{ |
| 1208 | 5 | this.banSnapshots = theBanSnapshots; |
| 1209 | 5 | } |
| 1210 | |
|
| 1211 | |
|
| 1212 | |
|
| 1213 | |
|
| 1214 | |
|
| 1215 | |
|
| 1216 | |
public boolean isBanTimestamps() |
| 1217 | |
{ |
| 1218 | 0 | return this.banTimestamps; |
| 1219 | |
} |
| 1220 | |
|
| 1221 | |
|
| 1222 | |
|
| 1223 | |
|
| 1224 | |
|
| 1225 | |
|
| 1226 | |
public void setBanTimestamps( boolean theBanTimestamps ) |
| 1227 | |
{ |
| 1228 | 1 | this.banTimestamps = theBanTimestamps; |
| 1229 | 1 | } |
| 1230 | |
|
| 1231 | |
public List getUnCheckedPlugins() |
| 1232 | |
{ |
| 1233 | 0 | return unCheckedPlugins; |
| 1234 | |
} |
| 1235 | |
|
| 1236 | |
public void setUnCheckedPlugins( List unCheckedPlugins ) |
| 1237 | |
{ |
| 1238 | 0 | this.unCheckedPlugins = unCheckedPlugins; |
| 1239 | 0 | } |
| 1240 | |
} |