ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Compiling from subdirs
Date Thu, 20 Jun 2002 18:40:01 GMT
I sent this to Bela privately, but thought maybe someone else might find
it useful. See:
for what he was looking to do. (Nutshell: Compile from a subdir only those
files in the current directory on down.)

<target name="compile">
  <path id="userdir" path="${user.dir}"/>
  <pathconvert property="in.dir" pathsep="" refid="userdir">
    <map from="${basedir}${file.separator}src${file.separator}" to=""/>
  <condition property="cur.dir" value="">
    <equals arg1="${in.dir}" arg2="${basedir}" casesensitive="no"/>
  <condition property="cur.dir" value="">
    <equals arg1="${in.dir}" arg2="${basedir}${file.separator}src"
  <property name="cur.dir" value="${in.dir}${file.separator}"/>
  <mkdir dir="classes"/>
  <javac srcdir="src" destdir="classes" includes="${cur.dir}**/*.java"/>

Note: Since there's only a top-level build file, you need to run with
Ant's -find option. You can set ANT_ARGS to include it for you instead of
having to type it every time, but be sure to include the build file name
as well, even if it's build.xml (otherwise, anything following -find will
get interpreted as the build file name [true, even when typed by hand on
the command-line, unless -find is the last arg]).



Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message