in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/property/AbstractPropertyEnforcerRule.java [85:104]
public void execute() throws EnforcerRuleException {
Object propValue = resolveValue();
// Check that the property is not null or empty string
if (propValue == null) {
String message = getMessage();
if (message == null) {
message = getName() + " \"" + getPropertyName() + "\" is required for this build.";
}
throw new EnforcerRuleException(message);
}
// If there is a regex, check that the property matches it
if (regex != null && !propValue.toString().matches(regex)) {
if (regexMessage == null) {
regexMessage = getName() + " \"" + getPropertyName() + "\" evaluates to \"" + propValue + "\". "
+ "This does not match the regular expression \"" + regex + "\"";
}
throw new EnforcerRuleException(regexMessage);
}
}