ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Muscalu <>
Subject RE: Possible Bug? Ant task <jar> does not handle files with over 255 chars in the path name
Date Fri, 23 May 2008 15:24:49 GMT

Hello Steve,
Thank you for taking the time to look into this. I am still a bit confused for the following
1. You seem to indicate that the problem resides with Java JVM. However, the bugs listed are
fairly old and have been closed for some time now. I am using Java 5 runtime and none of the
listed bugs were reported against it.
2. I put together a small Java application that lists the files in a directory. It than uses
Java IO API to copy the files from that directory into a target directory. It worked fine
although the source directory is the same directory the ANT <jar> tasks points to and
fails to copy all the files because of the long names.
Now, I know that things are usually more complex than what they seem to be but the fact that
Java was ok working with the long named files, ANT failed workng with the same files and the
OS was moody about it (Windows explorer vs DOS command prompt) makes me feel somehow lost
in this mix. Is it that ANT might use a different part of the Java API than the one I used
to accomplish the same task?
Also, from the standpoint of an user, ANT was given a task to accomplish. Non reporting when
a problem occures with that task I think goes a little beyond inconvenience. For instance,
the result of the build could be sent to production, not knowing that some files are missing
from the build. I am kind of placing ANT under the spot again...
Thank you very much again for your time,
Adrian> Date: Fri, 23 May 2008 15:47:00 +0100> From:> To:>
Subject: Re: Possible Bug? Ant task <jar> does not handle files with over 255 chars
in the path name> > Adrian Muscalu wrote:> > Hello,> > > > I am running
an ANT script on my Win XP machine; one of the tasks attempts to create a jar file where the
class files are in a directory with a long name. The combined path, package name and file
name exceedes 255 characters.> > > > Expected result:> > The script should
fail as the files exceed the Windows XP file system limitation.> > > > Actual
result:> > The build finishes with a successfull state although the files that have
the long name in the soturce directory have not been included into the jar.> > >
> I was hoping for ANT to report on the problem and stop the build; Ant managed to create
the long named files just fine, but any subsequent operation on them (copy, jar) fails without
notification. Any attempt to work with the files on the Windows DOS prompt (copy command)
ends with a pertinent message saying that the file name is too long and the operation fails.
> > > > Is this a bug? I don't expect ANT to fix the XP limitation, just to report
on it somehow.> > > > This is interesting. The first thing to consider is what
is MAX_PATH, > the limit on file length. Because the answer isnt 255, or even 260, its
> 32768 -but only under the unicode API, and you have to use funny \\?\ > filename prefixes>
>> > Assuming the Sun JVM uses
this API to talk to the OS -and it is an > assumption- then Ant should be able to work
with long filenames. But if > some of the API doesnt, we're in trouble.> > Looking
at the state of things, not all of java is consistent, even on java6>>> > But, some of the API does
work with long files, as you've noticed.> > 1. I dont think its an ant bug so much as
a JVM issue. We just open and > close files, and take whatever API we're given.> 2.
That doesnt mean it isnt inconvenient> > The fix is for the Java API to go to full length
filenames everywhere, > even if it gives you the right to create filenames that old apps
cant > handle.> > -- > Steve Loughran>
Author: Ant in Action> > --------------------------------------------------------------------->
To unsubscribe, e-mail:> For additional commands, e-mail:> 
Explore the seven wonders of the world
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message