code: private void copyScaffolding(File targetFile) throws IOException {
      String resourcePrefix = "com/carrotsearch/ant/tasks/junit4/templates/json/";
  
      File parent = targetFile.getParentFile();
  
      // Handle index.html substitutitons.
      ClassLoader cl = this.getClass().getClassLoader();
      String index = 
          Resources.toString(
              cl.getResource(resourcePrefix + "index.html"), Charsets.UTF_8);
      index = index.replaceAll(Pattern.quote("tests-output.jsonp"),
          removeExtension(targetFile.getName()) + ".jsonp");
  
      Files.write(index.getBytes(Charsets.UTF_8), targetFile);
      
      // Copy over the remaining files. This is hard coded but scanning a JAR seems like an overkill.
      String [] resources = {
          "js/jquery-1.7.1.min.js",
          "js/script.js",
          "js/jquery.pathchange.js",
          "img/pass.png",
          "img/error.png",
          "img/stderr.png",
          "img/arrow-up.png",
          "img/stdout.png",
          "img/indicator.png",
          "img/failure.png",
          "img/omited.png",
          "img/arrow-down.png",
          "css/style.css"
      };
  
      for (String resource : resources) {
        File target = new File(parent, resource);
        if (!target.getParentFile().exists()) {
          target.getParentFile().mkdirs();
        }
        URL res = cl.getResource(resourcePrefix + resource);
        if (res == null) {
          throw new IOException("Could not find the required report resource: " + resource);
        }
        Files.write(Resources.toByteArray(res), target); 
      }
    }
docs: Copy HTML/JS/CSS scaffolding to a targetFile's directory.