class JsonSchemaMojo extends AbstractMojo {

  @Override
  public void execute() throws MojoExecutionException {
    main.defineClasspath(toUrls(compileClasspathElements));
    main.setIncludeAdditionalProperties(includeAdditionalProperties);
    main.setSupportObjectReferences(supportObjectReferences);
    addExternalSchemas();

    if (rootClass == null) {
      throw new MojoExecutionException("No root class specified");
    }
    URL classUrl = main.getResource(toClassFileName(rootClass));
    if (classUrl == null) {
      throw new MojoExecutionException("Class " + rootClass + " not found");
    }

    if (updateNeeded(new File(classUrl.getPath()), getSchemaFile())) {
      getLog().info("Changes detected -- generating schema for " + rootClass + ".");
      generate();
    } else {
      getLog().info("Schema up-to-date. Skipping generation.");
    }
  }

}