When a certain number of source files is reached, Ant generates a filelist which it passes to the compiler. This filelist doesn't contain quotes around filenames which have spaces in them. Work-around: Make sure yourself that you use directory-names without spaces in them.
It will only use the file for "external" compilers like jikes or forked javac. Which compiler is causing problems for you? I'm rather sure that adding quotes around the filenames would cause jikes (at least on Unix) to fail.
We are using a forked version of javac to be sure that we are using the actual JDK1.1.7B version of javac. We have a substantial number (5000+) of java sources written in JDK1.1.7B and aren't taking the risk of using JDK1.4.0 with target "1.1" So, our build tool has to be able to support JDK1.4.0, JDK1.3 (for thin client development) and JDK1.1.7B.
Hmm, are you sure you really are using JDK 1.1's javac? According to my copy of the JDK 1.1 docs it doesn't support the @filelist option at all.
Oops, very sorry. The story was correct, but the problem arose with JDK1.4.0 We use fork for every version of the JDK because we need to use the extra settings such as MemoryInitialSize end MemoryMaxmimumSize
Yes, and this explains a lot. According to the docs: > An argument file can include javac options and source filenames in any > combination. The arguments within a file can be space-separated or > newline-separated. Oh my. So here quotes will become necessary for all platforms, I guess. Of course it is different for JDK 1.3 > you may specify one or more files that themselves contain one filename per > line. Could you test whether 1.3 (or 1.2 for that matter) needs quotes for filenames with spaces as well? I don't have a Windows box around and suspect things could depend on the OS.
Done the test with 1.3 and 1.4 against W2K and got the same results. Specs : Compilation on : Microsoft Windows 2000 [Version 5.00.2195] 1. Compiled against java full version "1.4.0-b92" error -> javac: invalid flag: C:\\ANTBUILD\\assemble\\DVL\\BA200302\\AXA .... 2. Compiled against java full version "1.3.1_01" error -> javac: invalid argument: C:\\ANTBUILD\\assemble\\DVL\\BA200302\\AXA ... Actual entry in the (example) source.file.list : "C:\ANTBUILD\assemble\DVL\BA200302\AXA Bank Java Core\build\javaroot\be\axa\ah\service\table\RendererMetrics.java" Both compiled correctly with the complete pathname in closing brackets. Cheers, Carlo PS. next reply will be next week or tomorrow (it's already 18:00 local time)
*** Bug 17683 has been marked as a duplicate of this bug. ***
*** Bug 19285 has been marked as a duplicate of this bug. ***
Should be fixed for JDK 1.4 with nightly build 2003-04-30. We'll need some more field testing to determine which other "external" compilers need similar treatment - I'd bet it depends on the OS as well.
I believe this bug is leading to problems in Tomcat, seen in bug 18595 and bug 19725.
I am re-opening this bug. Based on the fix I have seen for it in a recent 1.6 alpha nightly build it is not the correct fix. I was hoping it would make 1.5, but it seems to have missed the last 1.5 build (1.5.3). Here is the 'fix' in the 1.6 nightly build: for (int i = firstFileName; i < args.length; i ) { if (quoteFiles && args[i].indexOf(" ") > -1) { out.println("\"" args[i] "\""); } else { out.println(args[i]); } } This is not a complete fix. There are three problems with this fix: 1. It needs to escape backslashes, see bug 17683. Without doing this it will not work, especially on Windows which always uses backslashes. 2. The method decides whether to quote the names using the "quoteFiles" boolean parameter. However, there is no way of setting quoteFiles to True. There is no way of configuring Ant to do this. When used in Tomcat this will not be set. It would be great to always set this to True if running on Windows. At the moment, swapping ant.jar from the latest Ant 1.6 nightly-build into Tomcat 4.1.24 (which uses Ant 1.5.1), and restarting Tomcat does not fix the problem. The fix needs to work automatically. 3. The fix checks whether there is space before quoting the file. If someone wants to quote the file, why not always quote them. There might be other characters in the filename that need quoting (other white space). If it is going to check for spaces, then why do we need quoteFiles? Why not always quote files with spaces in their names? I would be grateful if the fix could be re-done. At the moment the default install of Tomcat on Windows doesn't work for small to medium sized applications.
Stefan Bodewig being on vacations, I am going to work on this bug. Cheers.
With the last nightly build of ant, with javac of jdk 1.3 or javac of jdk 1.4, compiling source code installed in paths with embedded spaces resulted in this type of error messages from the compiler : [javac] error: cannot read: C:dev estantdir spacentsrcmainorg pache oolszipAsiExtraField.java I have just submitted changes in DefaultCompilerAdapter and in JavacExternal which address the remarks of Joe Boon and Anne Kinsella. It should be in the next nightly build of ant. Cheers Antoine
I believe that this also occurs when you have a very long classpath. I am using Tomcat 4.1.24 and after adding a couple of jars, whenever I update the JSP pages, the compile fails. When looking at the stack trace, the classpath is very long, and truncated. Is this a result of the same issue, or a new bug?
truncated classpath would be a different bug. Does your problem happen on Windows ? (problem of environment variable space is well-known). Is your problem related to ant, or just to tomcat ? Antoine
*** Bug 21868 has been marked as a duplicate of this bug. ***
*** Bug 23401 has been marked as a duplicate of this bug. ***