Various compile tasks create temp files in the current working directory (via the user.dir system property, see method org.apache.tools.ant.taskdefs. compilers.DefaultCompilerAdapter.executeExternalCompile). There should be a way to define a different temp directory here (or use the java.io.tmpdir directory from Java 1.2 on). In a server installation with a bundled Ant, or in networked build environments, the current working directory may be read-only (eg, some /opt/... path). The same is probably true for other tasks that use the org.apache.tools.ant. taskdefs.FileUtils.createTempFile method with a null directory, like javadoc, cvstagdiff, and cab.
tempdir attribute in <javac> appears in nightly build 2003-05-16.