Dave
Dave

Reputation: 19110

How can I force a Maven clean?

I'm using Maven 3.0.3 on WinXP and running my Maven build commands through Cygwin. Occassionally, I'll be able to run a maven clean ...

 mvn clean install

And I'll get errors like ...

[INFO] Deleting C:\Documents and Settings\E18538\workspace\iteration1\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.891s
[INFO] Finished at: Mon Jan 23 11:07:58 CST 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project myco-productplus-web: Failed to clean project:Failed to delete C:\Documents and Settings\E18538\workspace\iteration1\target -> [Help 1]

Other than Cygwin, I'll close all other applications, but there is still a process holding something in "target". How do I figure out what that process is and then kill it? Note that when I restart my system, I can again run "mvn clean" commands.

Edit: The process that is holding onto the directory in question is "TGitCache.exe", spawned by TortoiseGit, installed on my system. I have marked the "target" directory as one to ignore, so I'm wondering if there's a way to cause this process to ignore target.

Thanks, - Dave

Upvotes: 5

Views: 22650

Answers (3)

Paramesh Korrakuti
Paramesh Korrakuti

Reputation: 2067

Use mvn clean -Dmaven.clean.failOnError=false to resolve this problem.

Upvotes: 3

Surekha
Surekha

Reputation: 610

I am using Spring(Eclipse) to do a maven clean and already had a command line and cygwin open with target as the current directory. I closed cygwin and other console, did a maven clean on the pom.xml in Spring and it worked!

This link helped me out: http://maven.apache.org/plugins/maven-clean-plugin/faq.html

Upvotes: 0

Abhinav Sarkar
Abhinav Sarkar

Reputation: 23782

Run mvn -X clean to see the actual error stacktrace to figure out what's wrong. As to check what is locking the directory see unlocker.

Upvotes: 5

Related Questions