protected void executeScript(
      final String script, final boolean spawn, final String... arguments) {
    ExecTask exec = ant.createTask(ExecTask.class);
    exec.setExecutable(script);

    if (spawn) {
      exec.setSpawn(true);
    } else {
      exec.setFailIfExecutionFails(true);
      exec.setFailonerror(true);
    }

    if (arguments != null) {
      for (String argument : arguments) {
        Commandline.Argument arg = exec.createArg();
        arg.setValue(argument);
      }
    }

    exec.setDir(new File(getConfiguration().getTargetDirectory(), getName()));
    exec.setFailIfExecutionFails(true);

    final Environment.Variable javaHome = new Environment.Variable();
    javaHome.setKey("JAVA_HOME");
    javaHome.setValue(System.getProperty("java.home"));
    exec.addEnv(javaHome);

    if (arguments != null && arguments.length > 0) {
      log.debug("Executing {} with arguments: {}", script, arguments);
    } else {
      log.debug("Executing {}", script);
    }

    exec.execute();
  }
 private void executeDotCover(DotcoverStep step, String xmlFile) {
   ExecTask exec = new ExecTask(this);
   exec.setProject(getProject());
   exec.setExecutable(execPath);
   exec.setFailonerror(failOnError);
   exec.setFailIfExecutionFails(failOnError);
   exec.createArg().setValue(step.name().toLowerCase());
   exec.createArg().setValue(xmlFile);
   exec.execute();
 }