Build build = new Build(buildFile); build.executeTarget("prepare");
    public void compile() {	ByteArrayOutputStream log = new ByteArrayOutputStream();	try {	    if (((PropertyService)getSession()).getProperty("build.dir") == null)		((PropertyService)getSession()).setProperty("build.dir", "/tmp/ide");	    // make sure we have a build directory	    File buildDir = new File((String)((PropertyService)getSession()).getProperty("build.dir"));	    if (!buildDir.exists())		buildDir.mkdirs();	    // make sure, the build.xml file is in place	    File buildFile = new File(buildDir, "build.xml");	    if (!buildFile.exists()) {		InputStream in = getSession().getServletContext().getResourceAsStream("/cg-build.xml");		OutputStream out = new FileOutputStream(buildFile);		new StreamPumper(in, out).run();	    }	    // make sure, all necessary libraries are in place	    File wingsJar = new File(buildDir, "lib/wings.jar");	    if (!wingsJar.exists()) {		InputStream in = getSession().getServletContext().getResourceAsStream("/WEB-INF/lib/wings.jar");		OutputStream out = new FileOutputStream(wingsJar);		new StreamPumper(in, out).run();	    }	    // build tree	    Build build = new Build(buildFile);	    build.executeTarget("prepare");	    PrintStream out = new PrintStream(log);	    build.getLogger().setOutputPrintStream(out);	    build.getLogger().setErrorPrintStream(out);	    // cg template	    props = null;	    File file = null;	    if (chooser.isVisible()) {		file = chooser.getFile();		if (file == null) {		    System.err.println("no file uploaded");		}		props = scanPlaf(new FileInputStream(file));		File to = new File(buildDir, "build/cg/" + props.getProperty("name") + ".plaf");		if (to.exists())		    to.delete();		file.renameTo(to);	    }	    else if (editor.isVisible()) {		props = scanPlaf(new StringBufferInputStream(editor.getText()));		file = new File(buildDir, "build/cg/" + props.getProperty("name") + ".plaf");		PrintWriter writer = new PrintWriter(new FileWriter(file));		writer.write(editor.getText());		writer.flush();	    }	    else if (name.isVisible()) {		file = new File(buildDir, "build/cg/" + name.getText() + ".plaf");		props = scanPlaf(new FileInputStream(file));	    }	    System.err.println("file: " + file.getCanonicalPath());	    selectComponent(props.getProperty("for"));	    Vector targets = new Vector(2);	    targets.add("java");	    targets.add("class");	    targets.add("plaf");	    build.executeTargets(targets);	}	catch (Exception e) {	    System.err.println(e.getMessage());	    e.printStackTrace(System.err);	}	finally {	    System.out.println("LOG");	    System.out.println("" + log);	}    }