You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by JH...@ids.com.au on 2004/01/05 05:40:05 UTC
whitespace for javac task
Hi Guys,
I have a white space character in my source directory name. This is
causing problems for my javac task.
Here is the relevant build file snippet:
<project name="dmslite" default="help">
<property name="src.dir" location="Java Source"/>
<property name="build.dir" location="build"/>
<target name="compile">
<echo>compile required java source files...</echo>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/classes"/>
<javac debug="on"
classpathref="build.classpath"
fork="true"
memoryInitialSize="128m"
memoryMaximumSize="128m"
srcdir="${src.dir}"
destdir="${build.dir}/classes"/>
<copy todir="${build.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
</target>
</project>
here are my results:
C:\xxxxx>ant deploy
Buildfile: build.xml
compile:
[echo] compile required java source files...
[javac] Compiling 1695 source files to C:\xxxxx\build\classes
[javac] javac: invalid flag: C:\xxxxx\Java
[javac] Usage: javac <options> <source files>
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose Output messages about what the
compiler is doing
[javac] -deprecation Output source locations where
deprecated APIs are used
[javac] -classpath <path> Specify where to find user class
files
[javac] -sourcepath <path> Specify where to find input source
files
[javac] -bootclasspath <path> Override location of bootstrap
class files
[javac] -extdirs <dirs> Override location of installed
extensions
[javac] -d <directory> Specify where to place generated
class files
[javac] -encoding <encoding> Specify character encoding used by
source files
[javac] -source <release> Provide source compatibility with
specified release
[javac] -target <release> Generate class files for specific
VM version
[javac] -help Print a synopsis of standard
options
BUILD FAILED
file:C:/xxxxx/build.xml:118: Compile failed; see the compiler error output
for details.
Total time: 3 seconds
Ofcourse the simplest solution would be to rename my "Java Source" direct
to something more sensible like "src", - but the project has a certain
amount of inertia, - just wondering if I can get this working without
changing one of the clearcase second-from-root directories...
Can I make the javac ant task not barf on whitespace?
thanks!
James Head
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: whitespace for javac task
Posted by Peter Reilly <pe...@corvil.com>.
It is more (much more) likely to be a bug with
java - exec for windows.
It has problems with quoting/not quoting for
windows crazy CreateProcess cmd parameter.
This raises differences between unix and windows
view of paramaters in java.lang.Runtime#exec().
Removal of the fork attribute should work.
Peter
J.Pietschmann wrote:
> JHead@ids.com.au wrote:
>
>> I have a white space character in my source directory name.
>
> ...
>
>> <property name="src.dir" location="Java Source"/>
>
> ...
>
>> <javac debug="on"
>> classpathref="build.classpath"
>> fork="true"
>> srcdir="${src.dir}"
>> destdir="${build.dir}/classes"/>
>
> ...
>
>> [javac] Compiling 1695 source files to C:\xxxxx\build\classes
>> [javac] javac: invalid flag: C:\xxxxx\Java
>> [javac] Usage: javac <options> <source files>
>
>
> Definitely a bug in Ant, the arguments to a forked JVM should
> be properly quoted. I can't seen a workaround unless you give
> up forking.
> It should work without forking though. Try this first.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: whitespace for javac task
Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 05 Jan 2004, J. Pietschmann <j3...@yahoo.de> wrote:
> Definitely a bug in Ant, the arguments to a forked JVM should
> be properly quoted.
Hmm, you are shooting too fast. 8-)
Ant uses the String[] version of exec to pass arguments, so they
shouldn't need to be quoted at all.
In the javac case, filenames are written to a file and read back from
there, so this is a little bit different - in particular since javac
knows the filenames are to be read one per line. Unfortunately the
last part of that sentence is only true for JDK < 1.4 as the @filelist
has been turned into @arglist in JDK 1.4.x and the rules have changed.
Ant 1.5.x (maybe just < 1.5.2, not sure) has not been aware of the
change in the rules. I'd suggest trying Ant 1.6.0 before giving up on
forked javac.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: whitespace for javac task
Posted by "J.Pietschmann" <j3...@yahoo.de>.
JHead@ids.com.au wrote:
> I have a white space character in my source directory name.
...
> <property name="src.dir" location="Java Source"/>
...
> <javac debug="on"
> classpathref="build.classpath"
> fork="true"
> srcdir="${src.dir}"
> destdir="${build.dir}/classes"/>
...
> [javac] Compiling 1695 source files to C:\xxxxx\build\classes
> [javac] javac: invalid flag: C:\xxxxx\Java
> [javac] Usage: javac <options> <source files>
Definitely a bug in Ant, the arguments to a forked JVM should
be properly quoted. I can't seen a workaround unless you give
up forking.
It should work without forking though. Try this first.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: whitespace for javac task
Posted by Al Caponi <do...@yahoo.com.sg>.
Try using the following property for source directory:
<property name="src.dir" location=""Java Source""/>
I guess that would pass "Java Source" (with the double-quotes) to javac. Let
us know if it works.
-----Original Message-----
From: JHead@ids.com.au [mailto:JHead@ids.com.au]
Sent: Monday, January 05, 2004 10:10 AM
To: user@ant.apache.org
Subject: whitespace for javac task
Hi Guys,
I have a white space character in my source directory name. This is
causing problems for my javac task.
Here is the relevant build file snippet:
<project name="dmslite" default="help">
<property name="src.dir" location="Java Source"/>
<property name="build.dir" location="build"/>
<target name="compile">
<echo>compile required java source files...</echo>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/classes"/>
<javac debug="on"
classpathref="build.classpath"
fork="true"
memoryInitialSize="128m"
memoryMaximumSize="128m"
srcdir="${src.dir}"
destdir="${build.dir}/classes"/>
<copy todir="${build.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
</target>
</project>
here are my results:
C:\xxxxx>ant deploy
Buildfile: build.xml
compile:
[echo] compile required java source files...
[javac] Compiling 1695 source files to C:\xxxxx\build\classes
[javac] javac: invalid flag: C:\xxxxx\Java
[javac] Usage: javac <options> <source files>
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose Output messages about what the
compiler is doing
[javac] -deprecation Output source locations where
deprecated APIs are used
[javac] -classpath <path> Specify where to find user class
files
[javac] -sourcepath <path> Specify where to find input source
files
[javac] -bootclasspath <path> Override location of bootstrap
class files
[javac] -extdirs <dirs> Override location of installed
extensions
[javac] -d <directory> Specify where to place generated
class files
[javac] -encoding <encoding> Specify character encoding used by
source files
[javac] -source <release> Provide source compatibility with
specified release
[javac] -target <release> Generate class files for specific
VM version
[javac] -help Print a synopsis of standard
options
BUILD FAILED
file:C:/xxxxx/build.xml:118: Compile failed; see the compiler error output
for details.
Total time: 3 seconds
Ofcourse the simplest solution would be to rename my "Java Source" direct
to something more sensible like "src", - but the project has a certain
amount of inertia, - just wondering if I can get this working without
changing one of the clearcase second-from-root directories...
Can I make the javac ant task not barf on whitespace?
thanks!
James Head
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org