简体   繁体   English

Maven - 未能执行目标 org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean

[英]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:我的 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?你有什么解决办法?

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:\EclipseProjects i guess you have eclipse running on that project.由于路径C:\EclipseProjects我猜你在那个项目上运行了 Eclipse。 If you application runs, you cannot clean the output, because it may be in use.如果您的应用程序运行,则无法清理输出,因为它可能正在使用中。

Stop the application and maybe eclipse and try again.停止应用程序,也许 Eclipse 并重试。

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

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

  • Solution 1: Sometimes the build fails because, the target folder cannot be deleted.解决方案 1:有时构建失败,因为目标文件夹无法删除。 (It might be open in the backend due to the previous builds.) (由于以前的构建,它可能在后端打开。)

    -> Open Task Manager -> 打开任务管理器

    -> In the Process tab -> 在进程选项卡中

    -> Do "End Process" for the running "java.exe" processess -> 为正在运行的“java.exe”进程执行“结束进程”

  • Solution 2:解决方案2:

    -> Restart eclipse -> 重启日食

    -> Perform Maven Build with command : clean install -DSkipTests -> 使用命令执行 Maven 构建:clean install -DSkipTests

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".我收到错误“无法删除文件,因为它正在被 Java TM SE 使用”。 So the file was being used by java process due to which eclipse was not able to delete it.所以这个文件被java进程使用,因为eclipse无法删除它。

I closed the java process from task manager and after that it worked fine.我从任务管理器中关闭了java进程,之后它工作正常。 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 进程有点忙,但它现在对我来说是可行的解决方案。

Kill the "Java (TM)" process from processes in your computer.从计算机中的进程中终止“Java (TM)”进程。 Re-run the mvn command.重新运行mvn命令。 It should work now.它现在应该可以工作了。

Reason and solution-原因及解决办法——

Everything happens for a reason :)一切发生的原因 :)

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project [错误] 无法在项目上执行目标 org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean)

  • The reason of this problem is that the target folder is already in use.此问题的原因是目标文件夹已在使用中。 That means any jar or any war or any application is using that target folder这意味着任何 jar 或任何战争或任何应用程序都在使用该目标文件夹

Solution- 1) Check the war and jar (also check jar if any running in background), terminate it.解决方案- 1)检查war和jar(如果在后台运行,还要检查jar),终止它。

2) if u have opened command prompt (cmd), and are using that path to execute the jar, close it or change the path in cmd. 2)如果您打开了命令提示符(cmd),并且正在使用该路径来执行 jar,请将其关闭或更改 cmd 中的路径。 This was the reason in my case.这就是我的原因。 Do check this.做检查。

Once u do this , u would be able to delete the contents of the target folder and and can also perform maven clean and maven install.一旦你这样做,你将能够删除目标文件夹的内容,并且还可以执行 maven clean 和 maven install。

On Windows, I got "Unable to delete directory".在 Windows 上,我得到“无法删除目录”。 What's wrong?怎么了? For instance, clean could fail if you already have opened a command line with target as the current dir.例如,如果您已经打开了一个以 target 作为当前目录的命令行,则 clean 可能会失败。 Windows locks some ressources and you need to close the handles on these ressources. Windows 会锁定一些资源,您需要关闭这些资源上的句柄。

This works for me.这对我有用。

if you run a server instance, stop it for the time of build process.如果您运行服务器实例,请在构建过程中停止它。 worked for me.为我工作。

In my case, it was Subversion, TortoiseSVN clinging to those files, so I just clicked on SVN in the Eclipse menu and then disconnect.在我的情况下,是 Subversion,TortoiseSVN 紧贴这些文件,所以我只是在 Eclipse 菜单中单击 SVN,然后断开连接。 Worked for me.为我工作。

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

就我而言,我更改了所有文件的所有者并且它有效。

sudo chown -R anuruddha *

For me it worked by closing the Eclipse and using the command line to build the project.对我来说,它通过关闭 Eclipse 并使用命令行来构建项目来工作。 Seems like Eclipse had taken a lock on the files.似乎 Eclipse 已经锁定了这些文件。

you may need to check whether the settings.xml file is correct.您可能需要检查settings.xml文件是否正确。 such as user name, password, third party url.例如用户名、密码、第三方网址。

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:我注意到有时 eclipse 会以某种方式拿起一些罐子并锁定它们(仅在 Windows 中),当您尝试执行 mvn clean 时,它会说:

[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.到目前为止唯一的解决方案是关闭 eclipse 并再次运行 mvn build。

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..当您执行类型搜索或资源搜索并忘记关闭它们/释放文件处理程序时,eclipse 可能会打开 jars。

如果你已经打开命令提示符(cmd)在当前文件夹运行jar,那么错误会如上。所以关闭命令提示符并尝试maven clean and install,它肯定会工作。

For IntelliJ users,对于 IntelliJ 用户,

1. File -> Invalidate your cache/restart the ide 
2. clean install -DSkipTests

In my case in my background I was inside the folder from command prompt after closing the command prompt.在我的背景中,我在关闭命令提示符后从命令提示符进入文件夹。 I was able to run the maven clean command.我能够运行 maven clean 命令。

For me clearing the previous maven tasks worked.对我来说,清除以前的 Maven 任务是有效的。 在此处输入图像描述

After clearing this, from eclipse project properties > run as > maven > clean followed by try maven build.清除后,从 Eclipse 项目属性 > 运行方式 > maven > clean 然后尝试 maven build。

Best luck!好运!

For me manually deleting the files in target folder using sudo worked.对我来说,使用 sudo 手动删除目标文件夹中的文件。 It's the need for root permission to delete files in the target folder.删除目标文件夹中的文件需要root权限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法执行目标org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean 如何解决“无法在项目上执行目标 org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean)”? - How to solve "Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project"? 运行Maven项目的多个“实例”-无法执行目标org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean - Running multiple 'instances' of maven project - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean Maven 无法执行目标 org.apache.maven.plugins:maven-clean-plugin:2.5:clean 无法删除 access_log - Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log 如何修复Maven异常:[错误]无法执行目标org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean - How to fix maven exception : [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean 无法在项目 spring-boot-keycloak 上执行目标 org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project spring-boot-keycloak Maven 全新安装:无法执行目标 org.apache.maven.plugins:maven-resources-plugin:3.20。 - Maven clean install: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources Maven:插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或其依赖项之一无法解析 - Maven : Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved 无法执行目标org.apache.maven.plugins:maven - Failed to execute goal org.apache.maven.plugins:maven Maven:无法执行目标 org.apache.maven.plugins:maven-resources-plugin:2.7:resources - Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM