class GenerateConnectorInspectionsMojo extends AbstractMojo {

    public JsonNode validateWithSchema(File jsonFile) throws MojoExecutionException {
        InputStream jsonStream = null;
        try {
            jsonStream = new FileInputStream(jsonFile);

            // Will parse and therefore check for well-formedness
            JsonNode jsonNode = JsonUtils.reader().readTree(jsonStream);

            // Validate against the loaded connection-schema
            ProcessingReport report = jsonSchema.validate(jsonNode, true);

            if (! report.isSuccess()) {
                for (final ProcessingMessage processingMessage : report) {
                    getLog().warn(processingMessage.toString());
                }

                throw new MojoExecutionException("Validation of json file " + jsonFile.getName() + " failed, see previous logs");
            }

            return jsonNode;
        } catch (IOException | ProcessingException ex) {
            throw new MojoExecutionException("Failure to validate json file " + jsonFile.getName(), ex);
        } finally {
            if (jsonStream != null) {
                try {
                    jsonStream.close();
                } catch (IOException e) {
                    getLog().error(e);
                }
            }
        }
    }

    public  GenerateConnectorInspectionsMojo();

}