[GRADLE-747] Deletion of files not working (maybe?) Created: 18/Nov/09  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.8
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Kirk Rasmussen Assignee: Hans Dockter
Resolution: Fixed Votes: 0


 Description   

I need to merge the contents of src/main/webapp with resources from a third party vendor (GXT). So far I have only got this working using the "ant.delete" method. I think I might be doing something wrong but maybe the manual could be clearer on how to do this. I specifically don't want to hook into the "normal" clean task which deletes the entire "build" directory.

The commented section below doesn't throw any exception but the directory (build/war) is not cleared.

webAppDirName = "$buildDir/war" 

task mergeWar << {
  description = 'Merge GXT resources with war source'
  
  ant.delete(dir: webAppDirName)
/*  
  clean {
    println "Cleaning $webAppDirName"
  	dir = file(webAppDirName)
  }
*/  
  
  copy {
    from 'src/main/webapp'
    into webAppDirName
  }
  ...
}


 Comments   
Comment by Hans Dockter [ 22/Nov/09 ]

There is no 'clean' method like we have for copy yet. We should and will have one eventually. The only thing we have at the moment is a clean task which has a dir property and deletes a directory. But in the example above you need a clean method and not a clean task. Using ant.delete is the best work around.

Comment by Hans Dockter [ 19/Apr/10 ]

This is fixed now. You can do:

task mergeWar << {
  description = 'Merge GXT resources with war source'
  
  delete(webAppDirName) // relative paths are resolved against the project dir.
  
  copy {
    from 'src/main/webapp'
    into webAppDirName
  }
  ...
}
Generated at Wed Jun 30 11:37:49 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.