Long pathnames on windows platforms cannot be deleted
-----------------------------------------------------

                 Key: MCLEAN-26
                 URL: http://jira.codehaus.org/browse/MCLEAN-26
             Project: Maven 2.x Clean Plugin
          Issue Type: Bug
    Affects Versions: 2.1.1
         Environment: Windows, JDK1.5 Update 7, 
            Reporter: V. B.
            Priority: Minor
         Attachments: MCLEAN-file-management.patch

NOTE: Could not find a specific project for file-management and since this 
project is getting affect by issue in file-management, I am reporting this 
problem and its solution here.

When projects reside in directory structure that causes absolute pathnames to 
go beyond 248 (maybe 260 on some Java versions) characters, files cannot be 
deleted on Windows platform. 

On further investigation, the root cause was the 
org.apache.maven.shared.model.fileset.util.FileSetManager.delete method's 
failure to successfully delete the class file in projects' target directory.
Caused by: java.io.IOException: Unable to delete file <class-file's very long 
pathname>
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.removeDir(FileSetManager.java:433)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.removeDir(FileSetManager.java:423)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.removeDir(FileSetManager.java:423)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.removeDir(FileSetManager.java:423)
        at 
org.apache.maven.shared.model.fileset.util.FileSetManager.delete(FileSetManager.java:189)
        at 
org.apache.maven.plugin.clean.CleanMojo.removeDirectory(CleanMojo.java:185)
        ... 19 more

This can be fixed by getting a canonical file from the specified file on 
failure and then attempting a delete as is apparent from the attached patch to 
file-management dependency's source:

groupId: org.apache.maven.shared
artifactId: file-management
version: 1.0



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to