简体   繁体   中英

How to solve "Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project"?

I am beginner in Maven. When I click clean & Build to rebuild my project in netbeans, it throws an error

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project xxxx-web: Failed to clean project: Failed to delete D:\\Gps2.x\\xxxx-web\\target\\xxxx-web-2.11-SNAPSHOT\\WEB-INF\\lib\\validation-api-1.0.0.GA.jar -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.

Or how to build a war file using maven package?

This usually happens in Windows environments when the target folder is "locked". Eg when you are running your web application (looks like you do) and want to perform a mvn clean . The application server/servlet engine locks the files so that mvn clean cannot delete the files because they are locked. Try to run this command when the web application is not running.

Edit: This also may happen if you have the target folder open in explorer or editing a text file from target folder, etc.

在 Glassfish 服务器的情况下,您只需停止服务器并在运行项目后进行清理和构建,它肯定会工作。确认

If you are using windows system, close all applications (eg file explorer, any file opened in eg notepad which is part of the "target" folder etc.). Basically, Maven is trying to Delete the file but as it is "locked" by some other application, Maven can't access it and hence can't delete it.

Clean the project once and rebuild it. If it is not working just kill the java process and restart the studio

系统重新启动对我有用。请尝试。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM