[PATCH] EclipsePlugin.extractResourceDirs() reuses String method argument 
causing maven-eclipse.xml copy-resources problems
---------------------------------------------------------------------------------------------------------------------------

                 Key: MECLIPSE-234
                 URL: http://jira.codehaus.org/browse/MECLIPSE-234
             Project: Maven 2.x Eclipse Plugin
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: Win2000
mvn 2.0.5
            Reporter: Peter Lynch
            Priority: Critical
         Attachments: EclipsePlugin.patch

I have a pom which defines multiple resources. Each resource is in it's own 
directory. Upon executing mvn eclipse:eclipse the maven-eclipse.xml that is 
generated contains todir attribute values that concantenates pom.xml targetPath 
values together in one long path. Further to this problem is the eclipse plugin 
tries to mkdir this long path. On windows this can be extremely bad as in my 
case it resulted in a path under target/classes that exceeded 256 chars long 
and about 50 dir levels deep.(this became impossible to delete on Windows 
without some magic renaming of each dir to '1' and using network shares...fun 
stuff).

Anyways it boils down to some buggy reuse of method arguments in the 
extractResourceDirs method. The output argument which is a string is reused in 
such a way as to cause the concantenation. I simply defined a local String to 
work around the problem.

Notice the patch also contains another fix in same method. One of the test 
cases was passing an absolute path based output dir. Since there is no javadoc 
I took a best guess to fix this bug. Maybe this was only a problem on windows.
See this part if you don't like it

{noformat} 
                // sometimes thisOutput is already an absolute path
                File outputFile = new File( thisOutput );
                if(!outputFile.isAbsolute()){
                    outputFile = new File( workspaceProjectBaseDir, thisOutput 
);
                }
{noformat} 







-- 
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