ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Surette <philsure...@home.com>
Subject Re: Question on wildcard
Date Fri, 26 Oct 2001 06:48:32 GMT
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}'
	srcdir='src'
	destdir='class'/>

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}'
	srcdir='src'
	destdir='class'/>

Krish_Srinivas@i2.com 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}"/>

Mime
View raw message