/** Execute this Ant task. Builds the given project according to the given parameters */
  @Override
  public void execute() throws BuildException {
    validateAttributes();
    project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    if (project == null) {
      displayError(TASKNAME + projectName + " project==null");
      return;
    }
    if (!project.exists()) {
      displayError(TASKNAME + projectName + " not found in Workspace.");
      return;
    }
    if (!project.isOpen()) {
      displayError(TASKNAME + projectName + " is not open");
      return;
    }

    try {
      AntConsoleProgressMonitor monitor = new AntConsoleProgressMonitor(this);
      monitor.beginTask(projectName, 1);
      setDebugOptions(debugcompilation);
      ProjectBuildWorkspaceModifyOperation op =
          new ProjectBuildWorkspaceModifyOperation(project, buildTypeInt);
      op.execute(monitor);
      // get/export errors and fail if needed
      int errors = getJavacErrorCount(project, monitor);
      if (errors > 0) {
        displayError(FAIL_MSG);
      }
      monitor.done();
    } catch (BuildException x) {
      throw x;
    } catch (Exception e) {
      displayError(TASKNAME + projectName + " Exception=" + e.getMessage());
    }
  }