public void execute()

in src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java [72:102]


    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(
                            "changes.xml file is not valid: " + xmlPath.getAbsolutePath() + ": " + e.getMessage(), e);
                }
            }
        }
    }