由Windows进程保持mvn清理失败

如何知道哪个窗口进程在执行“mvn clean”的同时保存文件夹会导致失败?

我怀疑有一些未知的过程持有我的“目标”文件夹,这阻止了我继续前进

有什么方法可以find这个未知的过程?

[DEBUG] Configuring mojo org.apache.maven.plugins:maven-clean-plugin:2.5:clean from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-clean-plugin:2.5, parent: sun.misc.Launcher$AppClassLoader@2d4b1fda] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-clean-plugin:2.5:clean' with basic configurator --> [DEBUG] (f) directory = C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target [DEBUG] (f) excludeDefaultDirectories = false [DEBUG] (f) failOnError = true [DEBUG] (f) followSymLinks = false [DEBUG] (f) outputDirectory = C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target\classes [DEBUG] (f) reportDirectory = C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target\site [DEBUG] (f) retryOnError = true [DEBUG] (f) skip = false [DEBUG] (f) testOutputDirectory = C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target\test-classes [DEBUG] -- end configuration -- [INFO] Deleting C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target [INFO] Deleting directory C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 26.290 s [INFO] Finished at: 2017-08-21T15:16:16+05:30 [INFO] Final Memory: 14M/124M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project quality-manager: Failed to clean project: Failed to delete C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project quality-manager: Failed to clean project: Failed to delete C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to clean project: Failed to delete C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:215) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more Caused by: java.io.IOException: Failed to delete C:\RafiWork\TASK\French\Sprint2\pdm_sonartool\quality-manager\target at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:249) at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:191) at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:117) at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:193) 

当我离开调试器运行或项目在本地web服务器上运行时,我倾向于得到这个。 有时甚至当你认为你已经停下来的时候,它可能会变得有趣而且四处流浪。

当发生这种情况时,我通常倾向于去任务管理器,并杀死在我的机器上运行的任何Java进程,并通常修复它。

使用来自Mark Russinovitch,Sysinternals(现在是Microsoft)的Handle: https : //docs.microsoft.com/en-us/sysinternals/downloads/handle

这将帮助您找到违规者(通常是您自己的Java进程,或Explorer.exe,甚至是您运行Maven的地方的CMD.EXE)。