嗨,我有一个maven项目,在尝试清理时我得到以下错误,任何人都帮助我

时间:2017-08-16 10:09:13

标签: maven-2

这是我得到的错误,战争正在产生,但在尝试清理时抛出错误

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project ins-model: Failed to clean project: Failed to delete D:\VEMASVNINSURANCEWS\AIG\ins-parent\ins-model\target\surefire-reports -> [Help 1]
 Failed to execute goal-clean-plugin:2.4.1:clean (default-clean) on project ins-model: Failed to clean project: Failed to delete ins-parent\ins-model\target\surefire-reports
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to clean project: Failed to delete D:\VEMASVNINSURANCEWS\AIG\ins-parent\ins-model\target\surefire-reports
    at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:188)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.io.IOException: Failed to delete 
[ERROR] 
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]  <goals>  :ins-model

这是我得到的错误,战争正在产生,但在尝试清理时抛出错误

2 个答案:

答案 0 :(得分:1)

您在Windows上,如果任何程序当前锁定了target内的某个程序,则无法删除mvn clean文件夹(基本上target的作用)。

根据您的日志,这是锁定的文件夹surefeire-report所以:您之前的构建未完成,并且您还有一个Java线程仍然锁定该文件夹,或者您已在控制台/浏览器中打开它

答案 1 :(得分:0)

其他一些进程正在使用受clean(目标)影响的目录(的一部分)。一些可能的罪犯:

  • 早先从IDE启动但仍在运行的应用程序。

  • 在文件管理器中打开嵌套在父目录(目标)中的目录,它可能会锁定要清理的部分内容。