Java Maven - 无法执行目标 org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20442862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 01:57:39  来源:igfitidea点击:

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

javaspringmavenspring-mvc

提问by user2274060

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

我的 pom.xml 中的以下依赖项存在问题,其中 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 :

当我执行命令行“mvn clean install”时,出现以下错误:

 [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:\EclipseProjects\myGoogleAppEngine\target\myGoogleAppEngine-0.0.1-SNAPSHOT\WEB-INF\lib\spring-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.

通过在http://mvnrepository.com/artifact/org.springframework/spring-webmvc/3.1.0.RELEASE 上查看,我的依赖项中没有任何错误。

Do you have any solutions?

你有什么解决方案?

回答by Christian Kuetbach

Failed to delete C:\EclipseProjects\myGoogleAppEngine\target\myGoogleAppEngine-0.0.1-SNAPSHOT\WEB-INF\lib\spring-webmvc-3.1.0.RELEASE.jar

无法删除 C:\EclipseProjects\myGoogleAppEngine\target\myGoogleAppEngine-0.0.1-SNAPSHOT\WEB-INF\lib\spring-webmvc-3.1.0.RELEASE.jar

Because of the path C:\EclipseProjectsi 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我猜您在该项目上运行了 Eclipse。如果应用程序运行,则无法清除输出,因为它可能正在使用中。

Stop the application and maybe eclipse and try again.

停止应用程序,也许 eclipse 并重试。

回答by Kworks

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.

确保您对文件夹的权限正确。因为我遇到了同样的问题,在更改了文件夹和文件的所有权后,问题就解决了。

回答by Kworks

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

如果您运行服务器实例,请在构建过程中停止它。为我工作。

回答by shashi009

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.

尝试更改工作区文件夹的权限。确保您有足够的权限删除此文件夹中的文件。我遇到了同样的问题,当我提供对项目文件夹的完全控制(更改 Windows 安全权限)时,它对我来说很好用。

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.

我收到错误“无法删除文件,因为它正在被 Java TM SE 使用”。因此该文件正被 java 进程使用,因为 eclipse 无法删除它。

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.

我从任务管理器关闭了 java 进程,之后它工作正常。虽然每次我需要执行我的项目时关闭 java 进程有点忙,但它现在对我来说是可行的解决方案。

回答by gmode

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.

就我而言,它是 Subversion,TortoiseSVN 紧贴这些文件,所以我只需单击 Eclipse 菜单中的 SVN,然后断开连接。为我工作。

回答by masthan rao

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

如果您打开它试图删除的目录,那么您也将面临同样的错误,因此请先关闭该文件夹。

回答by Anuruddha Lanka Liyanarachchi

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

在我的情况下,我更改了所有文件的所有者并且它起作用了。

sudo chown -R anuruddha *

回答by tanvi

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.

对我来说,它通过关闭 Eclipse 并使用命令行来构建项目来工作。似乎 Eclipse 已经锁定了这些文件。

回答by mak k

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

从您计算机中的进程中杀死 java (TM) 进程。重新运行 mvn cmd 。它现在应该可以工作了。

回答by sdfs

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

删除任务管理器中的 java.exe 进程并重新执行。它对我有用。