title: Why doesn't Maven's mvn clean ever work the first time?
body: <p>Nine times out of ten when I run <strong>mvn clean</strong> on my projects I experience a build error. I have to execute <strong>mvn clean</strong> multiple times until the build error goes away. Does anyone else experience this? Is there any way to fix this within Maven? If not, how do you get around it? I wrote a bat file that deletes the target folders and that works well, but it's not practical when you are working on multiple projects. I am using Maven 2.2.1.</p>
  
  <pre><code>[ERROR] BUILD ERROR
  [INFO] ------------------------------------------------------------------------
  [INFO] Failed to delete directory: C:\Documents and Settings\user\My Documents\software-developm
  ent\a\b\c\application-domain\target. Reason: Unable to delete directory C:\Documen
  ts and Settings\user\My Documents\software-development\a\b\c\application-domai
  n\target\classes\com\a\b
  
  [INFO] ------------------------------------------------------------------------
  [INFO] For more information, run Maven with the -e switch
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 6 seconds
  [INFO] Finished at: Fri Oct 23 15:22:48 EDT 2009
  [INFO] Final Memory: 11M/254M
  [INFO] ------------------------------------------------------------------------
  </code></pre>