public void execute ( EnforcerRuleHelper helper ) throws EnforcerRuleException { boolean callSuper ; MavenProject project = null ; if ( onlyWhenRelease ) { // get the project project = getProject ( helper ) ; // only call super if this project is a release callSuper = ! project . getArtifact ( ) . isSnapshot ( ) ; } else { callSuper = true ; } if ( callSuper ) { super . execute ( helper ) ; if ( failWhenParentIsSnapshot ) { if ( project == null ) { project = getProject ( helper ) ; } Artifact parentArtifact = project . getParentArtifact ( ) ; if ( parentArtifact != null && parentArtifact . isSnapshot ( ) ) { throw new EnforcerRuleException ( "Parent Cannot be a snapshot: " + parentArtifact . getId ( ) ) ; } } } }
Override parent to allow optional ignore of this rule .