ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Question on wildcard
Date Fri, 26 Oct 2001 14:14:06 GMT
It seems I was not clear in my earlier mail. I will try to explain this 
once more. Actually, I am not supposed to compile any java files in ant. I 
am only supposed to create a script through Ant ( here it is called 
compile.cmd) which should  take all java files in the argument. I will use 
this generated script to compile the java files whenever I want. So the 
Ant script is not compiling per se and is only generating a script to do this.

My question is how do i get all the java files shown in that generated 
script(compile.cmd) as an argument to Javac command. The number of such 
java files and the names may vary with time.



Phil Surette <>
10/26/01 01:48 AM
Please respond to ant-user

        Subject:        Re: Question on wildcard

There's normally no need for this kind
of scripting chicanery in ant ;)

The way to compile java classes in ant is with the
javac task. You can give it any number of source and
class paths you like. There's no difficulty difficulty
compiling all the scripts in a directory together.

I don't understand make well enough to grok exactly
what you're doing -- '$(wildcard *.java)'? -- but typically
in an ant build file you would (minimally) do this:

<javac classpath='${released.class.path}'

which will compile all java files in the 'src' directory
into the 'class' directory, with the classes in whatever 
${released.class.path} evaluates to being available to
in the compiler's classpath.

Note that ${released.class.path} is the notation for
referring to an ant property. If you want to use
a bona fide environment variable, try

<property environment='env'/>
<javac classpath='${env.RELEASED_CLASS_PATH}'
                 destdir='class'/> wrote:
> Hi
> I am in the process of converting one Imakefile to Ant. I have not
> been able to convert the following line in that Imakefile to Ant:
> gentests::
>         @echo "$(JDK_ROOT)/bin/javac -classpath
> \"$(RELEASED_CLASS_PATH)\" $(wildcard *.java)" > compile.cmd
> This statement above basically creates a script that can in turn be
> used to compile some java files. The directory in which this Imakefile
> is present has some java filesthe number of which changes from time to
> time. So this script, basically compiles all the java files in the
> given directory together in one statement. The script 'command.cmd'
> generated basically has space-seperated java files substituted for
> $(wildcard *.java).
> I have not been able to figure out how to create the equivalent of
> this in Ant. Please let me know how to convert this.
> Thanks
> K.Srinivas
> P.S: I attempted the following equivalent but it gives a
> colon-seperated list of java files
> <path id="java.path">
>              <fileset dir="SampleTests">
>              <include name="*.java"/>
>              </fileset>
>              </path>
>              <property name="wildcard" refid="java.path">
>              </property>
>         <echo file="compile.cmd" message="javac -classpath
> ${RELEASED_CLASS_PATH} ${wildcard}"/>

View raw message