ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17683] New: - javac task fails if path for java file contains space and if using external compiler
Date Wed, 05 Mar 2003 17:18:53 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17683>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17683

javac task fails if path for java file contains space and if using external compiler

           Summary: javac task fails if path for java file contains space
                    and if using external compiler
           Product: Ant
           Version: 1.5
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: anne.kinsella@iona.com


If you try to compile java files which are in a directory containing a space 
(for example in program files), you cannot fork the javac task. 
I've worked around the problem by updating the following ant src file:

main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java

Changed the method executeExternalCompile(String[] args, int firstFileName)  to 
put quotes around the java file names.


So the following :

   for (int i = firstFileName; i < args.length; i++) {
      out.println(args[i]);
   }

becomes 

    for (int i = firstFileName; i < args.length; i++) {
      if ( i==0)
      {
         out.println(args[i]);
      }
      else 
      {
        args[i] = args[i].replace('\\', '/');
        out.println( "\"" + args[i] + "\"");
      }
   }

Mime
View raw message