protected boolean hasValidVersionSpecified ( EnforcerRuleHelper helper , Plugin source , List < PluginWrapper > pluginWrappers ) { boolean found = false ; boolean status = false ; for ( PluginWrapper plugin : pluginWrappers ) { // find the matching plugin entry if ( source . getArtifactId ( ) . equals ( plugin . getArtifactId ( ) ) && source . getGroupId ( ) . equals ( plugin . getGroupId ( ) ) ) { found = true ; // found the entry. now see if the version is specified String version = plugin . getVersion ( ) ; try { version = ( String ) helper . evaluate ( version ) ; } catch ( ExpressionEvaluationException e ) { return false ; } if ( StringUtils . isNotEmpty ( version ) && ! StringUtils . isWhitespace ( version ) ) { if ( banRelease && version . equals ( "RELEASE" ) ) { return false ; } if ( banLatest && version . equals ( "LATEST" ) ) { return false ; } if ( banSnapshots && isSnapshot ( version ) ) { return false ; } // the version was specified and not // banned. It's ok. Keep looking through the list to make // sure it's not using a banned version somewhere else. status = true ; if ( ! banRelease && ! banLatest && ! banSnapshots ) { // no need to keep looking break ; } } } } if ( ! found ) { log . debug ( "plugin " + source . getGroupId ( ) + ":" + source . getArtifactId ( ) + " not found" ) ; } return status ; }
Checks for valid version specified .