This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 193772

Summary: Project clean fails on delete file
Product: projects Reporter: pavelvesely
Component: MavenAssignee: Jesse Glick <jglick>
Status: RESOLVED WONTFIX    
Severity: normal CC: dkonecny
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:
Attachments: sample project
maven output
same project step later, error reemerges
maven output

Description pavelvesely 2010-12-23 13:07:03 UTC
Project clean fails when run from Netbeans:

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project drill: Failed to clean project: Failed to delete C:\workspace\drill\target\endorsed\javaee-endorsed-api-6.0.jar

Running mvn clean outside Netbeans works without problems.
Comment 1 pavelvesely 2010-12-23 13:08:08 UTC
Created attachment 104450 [details]
sample project
Comment 2 pavelvesely 2010-12-23 13:08:37 UTC
Created attachment 104451 [details]
maven output
Comment 3 pavelvesely 2010-12-24 09:12:00 UTC
Created attachment 104472 [details]
same project step later, error reemerges
Comment 4 pavelvesely 2010-12-24 09:12:30 UTC
Created attachment 104473 [details]
maven output
Comment 5 Jesse Glick 2011-01-07 22:33:23 UTC
Something is holding open the JAR, and Windows has mandatory file locks. (And unlike Unix, you cannot hold open a file descriptor after unlinking the inode.) I doubt there is anything to be done about it, unless you are able to track down what exactly is holding the JAR open. (Assuming it is the NB process itself, heap analysis tools can show you all instances of java.util.zip.ZipFile and what the GC root references are.)

In this case, target/endorsed/*.jar is a workaround for http://jira.codehaus.org/browse/MNG-4752 (lack of direct support for endorsed scope).

(In reply to comment #0)
> Running mvn clean outside NetBeans works without problems.

NB 7.0 always forks the mvn executable so it should not make a difference, but timing may matter since file locks may be released after a GC.
Comment 6 David Konecny 2011-01-09 22:46:50 UTC
Was your project deployed to running server when you cleaned it? If yes then you may be experiencing issue 192895.