in src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java [72:116]
public void execute()
throws MojoExecutionException
{
// Run only at the execution root
if ( runOnlyAtExecutionRoot && !isThisTheExecutionRoot() )
{
getLog().info( "Skipping the changes validate in this project because it's not the Execution Root" );
}
else
{
if ( !xmlPath.exists() )
{
getLog().warn( "changes.xml file " + xmlPath.getAbsolutePath() + " does not exist." );
return;
}
try
{
XmlValidationHandler xmlValidationHandler =
changesSchemaValidator.validateXmlWithSchema( xmlPath, changesXsdVersion, failOnError );
boolean hasErrors = !xmlValidationHandler.getErrors().isEmpty();
if ( hasErrors )
{
logSchemaValidation( xmlValidationHandler.getErrors() );
if ( failOnError )
{
throw new MojoExecutionException( "changes.xml file " + xmlPath.getAbsolutePath()
+ " is not valid, see previous errors." );
}
else
{
getLog().info( " skip previous validation errors due to failOnError=false." );
}
}
}
catch ( SchemaValidatorException e )
{
if ( failOnError )
{
throw new MojoExecutionException( "failed to validate changes.xml file " + xmlPath.getAbsolutePath()
+ ": " + e.getMessage(), e );
}
}
}
}