Jacob Kjome
2003-05-12 18:44:04 UTC
I have a property that contains a colon separated list of base directories
for sending to javac so that it will compile from multiple source
directories. Now I need to copy any properties or xml files from each and
every one of those source directories to the build directory. However,
Filesets can only point to a single source directory the the copy fails
with the source directory given to the Fileset is this colon separated list
of source directories. Is there any way to do what I need without
resorting to ant-contrib <foreach> and things like that?
So, I have....
in build.properties...
contrib.path=contrib
src.contrib.projects=${contrib.path}/rollbackWithMementoPattern \
:${contrib.path}/jxpath \
:${contrib.path}/socketServer/client \
:${contrib.path}/socketServer/common \
:${contrib.path}/socketServer/example \
:${contrib.path}/socketServer/server \
:${contrib.path}/btree
in build.xml...
<target name="compile.contrib" depends="download.contrib.dependencies,
compile.core"
description="Compile contrib sources" >
<antcall target="-compile.sub">
<param name="srcdir" value="${src.contrib.projects}" />
<param name="includes" value="**/*.java" />
<param name="excludes" value="**/old**/**" />
</antcall>
</target>
<target name="-compile.sub" if="srcdir" >
<javac
srcdir="${srcdir}"
destdir="${build.home}"
includes="${includes}"
excludes="${excludes}"
debug="${build.debug}"
deprecation="${build.deprecation}"
optimize="${build.optimize}"
verbose="${build.verbose}">
<classpath refid="build.classpath" />
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}" >
<fileset
dir="${srcdir}"
excludes="${excludes}"
includes="**/*.properties,
**/*.ini,
**/*.character-sets,
**/*.dtd,
**/*.xsd,
**/*.*ml" />
</copy>
</target>
Obviously the <copy task will fail because the fileset gets a ${srcdir}
property containing a colon separated list of source directories. Can
someone think of a nifty way of using <pathconvert> or something like that
to do what I need here? Is there another approach that will work? Again,
if it involves ant-contrib stuff, I can figure out how to do that just
fine. I'm just looking for a pure ant solution. I want to know whether it
is possible or not before I give up on Ant proper here.
thanks,
Jake
for sending to javac so that it will compile from multiple source
directories. Now I need to copy any properties or xml files from each and
every one of those source directories to the build directory. However,
Filesets can only point to a single source directory the the copy fails
with the source directory given to the Fileset is this colon separated list
of source directories. Is there any way to do what I need without
resorting to ant-contrib <foreach> and things like that?
So, I have....
in build.properties...
contrib.path=contrib
src.contrib.projects=${contrib.path}/rollbackWithMementoPattern \
:${contrib.path}/jxpath \
:${contrib.path}/socketServer/client \
:${contrib.path}/socketServer/common \
:${contrib.path}/socketServer/example \
:${contrib.path}/socketServer/server \
:${contrib.path}/btree
in build.xml...
<target name="compile.contrib" depends="download.contrib.dependencies,
compile.core"
description="Compile contrib sources" >
<antcall target="-compile.sub">
<param name="srcdir" value="${src.contrib.projects}" />
<param name="includes" value="**/*.java" />
<param name="excludes" value="**/old**/**" />
</antcall>
</target>
<target name="-compile.sub" if="srcdir" >
<javac
srcdir="${srcdir}"
destdir="${build.home}"
includes="${includes}"
excludes="${excludes}"
debug="${build.debug}"
deprecation="${build.deprecation}"
optimize="${build.optimize}"
verbose="${build.verbose}">
<classpath refid="build.classpath" />
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}" >
<fileset
dir="${srcdir}"
excludes="${excludes}"
includes="**/*.properties,
**/*.ini,
**/*.character-sets,
**/*.dtd,
**/*.xsd,
**/*.*ml" />
</copy>
</target>
Obviously the <copy task will fail because the fileset gets a ${srcdir}
property containing a colon separated list of source directories. Can
someone think of a nifty way of using <pathconvert> or something like that
to do what I need here? Is there another approach that will work? Again,
if it involves ant-contrib stuff, I can figure out how to do that just
fine. I'm just looking for a pure ant solution. I want to know whether it
is possible or not before I give up on Ant proper here.
thanks,
Jake