Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean



I've a problem with the following dependency in my pom.xml where org.springframework.version = 3.1.0.RELEASE:


<!-- Spring MVC framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>$org.springframework.version</version>
</dependency>



When I execute the command line 'mvn clean install', I've the following error :


[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.052s
[INFO] Finished at: Sat Dec 07 15:49:04 CET 2013
[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 myGoogleAppEngine: Failed to clean project: Failed to delete C:EclipseProjectsmyGoogleAppEnginetargetmyGoogleAppEngine-0.0.1-SNAPSHOTWEB-INFlibspring-webmvc-3.1.0.RELEASE.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException



By seeing on http://mvnrepository.com/artifact/org.springframework/spring-webmvc/3.1.0.RELEASE , there aren't any errors in my dependency.



Do you have any solutions?





Try link
– mic4ael
Dec 7 '13 at 15:10




12 Answers
12



Failed to delete
C:EclipseProjectsmyGoogleAppEnginetargetmyGoogleAppEngine-0.0.1-SNAPSHOTWEB-INFlibspring-webmvc-3.1.0.RELEASE.jar



Because of the path C:EclipseProjects i guess you have eclipse running on that project. If you application runs, you cannot clean the output, because it may be in use.


C:EclipseProjects



Stop the application and maybe eclipse and try again.





I always have the same problem
– user2274060
Dec 7 '13 at 15:58





I think there is a running process, which has the jar loaded.
– Christian Kuetbach
Dec 7 '13 at 16:21





Glassfish server in my case. Not only you have to undeploy your applications but stop the server as well.
– alextsil
Mar 28 '15 at 9:18





In my case also it is GlassFish server. Have to stop it as well before doing clean and build.
– SoProgram
May 7 '17 at 15:40



Delete the java.exe process in Task Manager and re-execute.It worked for me.



Make sure that your permissions are correct on the folder.As i faced same problem and after changing the ownership of the folder and files the problem was solved.



Try changing the permissions on the workspace folder. Make sure you have sufficient permissions to delete files in this folder.
I faced the same problem and when i provided full control over the project folder (changing windows security permissions), it worked fine for me.



Just to update, this morning it again started giving the same error even when i have given all the permissions. So i tried to delete the particular file (pointed in the error logs) manually to find out what's exactly the problem.



I got the error "can not delete file because it's in use by Java TM SE". So the file was being used by java process due to which eclipse was not able to delete it.



I closed the java process from task manager and after that it worked fine. Although its kinda hectic to close the java process every time I need to execute my project, its the working solution right now for me.



kill the java (TM) process from processes in you computer. re-run mvn cmd . It should work now.



if you run a server instance, stop it for the time of build process. worked for me.





It also worked for me! Thank you!
– Thisisalexis
Nov 15 '17 at 15:19



In my case, it was Subversion, TortoiseSVN clinging to those files, so I just clicked on SVN in the Eclipse menu and then disconnect. Worked for me.



If you open the directory which it is trying to delete then also you will face same error so first close the folder.



In my case I changed the owner of all the files and it worked.


sudo chown -R anuruddha *





User is running on Windows not a *NIX environment
– Dave G
Mar 28 '16 at 13:22



For me it worked by closing the Eclipse and using the command line to build the project. Seems like Eclipse had taken a lock on the files.



you may need to check whether the settings.xml file is correct.
such as user name, password, third party url.


settings.xml



I've noticed that sometimes eclipse somehow picks up some of the jars and keeps a lock on them (in Windows only) and when you try to do mvn clean it says:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.2:clean (default-clean) on project


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.2:clean (default-clean) on project



The only solution so far is to close eclipse and run the mvn build again.



And these are random jars - it can pick up anything it wants...
Why that happens is a mystery to me. Probably eclipse opens the jars when you do Type Search or Resource Search and forgets to close them / release the file handlers..






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard