How to set temp directory for tasks

If I start a task which uses following command:

earsList.each {File earFile ->
      FileTree aZipTree = this.project.zipTree(earFile).matching {it.include('**/*.jar')}
      aZipTree.getFiles().each {
          Files.copy(it, destfile)

the problem is, that this task is creating a “build/tmp/expandedArchives” directory which al lot of tmp files in it. It seems to be that the task don’t clean up this directory if it is finished. Where I can define a specific tmp folder for this task or where I can set a flag to clean up by itself? Thanks in advance!