in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/RequireReleaseDeps.java [60:89]
public void execute() throws EnforcerRuleException {
boolean callSuper;
if (onlyWhenRelease) {
// only call super if this project is a release
callSuper = !getSession().getCurrentProject().getArtifact().isSnapshot();
} else {
callSuper = true;
}
if (callSuper) {
super.execute();
if (failWhenParentIsSnapshot) {
Artifact parentArtifact = getSession().getCurrentProject().getParentArtifact();
if (parentArtifact != null) {
Set<Artifact> singletonArtifact = new HashSet<>();
singletonArtifact.add(parentArtifact);
Set<Artifact> artifacts = filterArtifacts(singletonArtifact);
parentArtifact = ofNullable(artifacts)
.flatMap(s -> s.stream().findFirst())
.orElse(null);
}
if (parentArtifact != null && parentArtifact.isSnapshot()) {
throw new EnforcerRuleException("Parent Cannot be a snapshot: " + parentArtifact.getId());
}
}
}
}