Ant not excluding on javac task

S

sowbug

My script will exclude whole directories in the javac task, but it
will not exclude individual files from being compiled. Can someone
please have a look and tell me what I'm doing wrong?


<?xml version="1.0" encoding="UTF-8"?>
<project basedir="../../java/" default="all" name="BuildProject">

<target name="init">
<property name="hello" value="world"/>
<property name="project_dir" value="/Project/"/>
<property name="java_dir" value="/home/Jack/cvs/ascii/java/"/>
</target>

<target depends="init" name="clean" description="Clean all build
products">
<delete failonerror="false">
<fileset dir="${project_dir}">
<exclude name="j2sdk1.4.1"/>
</fileset>
</delete>
</target>

<target depends="init,clean" name="checkout">
<!--<exec dir="/home/Jack" executable="./cvs_commit.sh"/>
<exec dir="/home/Jack" executable="./checkout.sh"/>
<exec dir="/home/Jack" executable="./cvs_edit.sh"/>-->
</target>

<target name="XmlValidate">
<property name="xml_dir" value="../xml"/>
<xmlvalidate failonerror="no" warn="no" >
<fileset dir="${xml_dir}/docs" includes="**/*.xml"/>
<fileset dir="${xml_dir}/programs" includes="**/*.xml" />
<fileset dir="${xml_dir}/reports" includes="**/*.xml"/>
</xmlvalidate>
</target>

<target depends="init,clean,checkout" name="compile">
<javac nowarn="true" debug="true" verbose="false"
deprecation="true" destdir="${project_dir}" srcdir="${java_dir}"
failonerror="false" fork="yes" memoryMaximumSize="512m">
<classpath><pathelement
location="${java_dir}"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/AbsoluteLayout.jar"/></classpath>
<include name="com/"/>
</javac>
<javac nowarn="true" debug="true" verbose="false"
deprecation="true" destdir="${project_dir}" srcdir="${java_dir}"
failonerror="false" fork="yes" memoryMaximumSize="512m">
<classpath><pathelement
location="${java_dir}"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/AbsoluteLayout.jar"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/junit-ext.jar"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/junit.jar"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/TimerBean.jar"/></classpath>
<classpath><pathelement
location="${project_dir}j2sdk1.4.1/lib/ext/DataVision.jar"/></classpath>
<include name="ar/"/>
<exclude name="ar/client/project/ext/"/>
<exclude name="ar/client/dp/ext/"/>
<exclude name="ar/client/dp/server/ServerUBP.java"/>
<exclude name="ar/client/dp/server/ServerURL.java"/>
<exclude name="ar/client/project/server/ServerUSH.java"/>
<exclude name="ar/client/project/server/ServerUQY.java"/>
<exclude
name="ar/client/project/junit/generated/bp/BP7901Test.java"/>
<exclude name="ar/client/project/server/ServerUUT.java"/>
<exclude
name="ar/client/project/server/ServerR7018.java"/>
<exclude
name="ar/client/project/server/ServerR7153.java"/>
<exclude
name="ar/client/project/server/ServerR7240.java"/>
<exclude
name="ar/client/project/server/ServerR7285.java"/>
<exclude
name="ar/client/dp/server/ServerSysDeviceProf.java"/>
<exclude
name="ar/client/dp/server/ServerSysUserProf.java"/>
<exclude
name="ar/client/project/server/ServerDataDictionary.java"/>
<exclude
name="ar/client/project/server/ServerDialogCheckSheet.java"/>
</javac>
</target>


<target depends="init,clean,checkout,compile,XmlValidate"
description="Build everything" name="all">
<echo message="Application built. Hello ${hello}!"/>
</target>

</project>
 
S

sowbug

I know the code got kind of jumbled, but if someone will just please
have a look at this simple problem, I know it would be easily fixed
and I will go away. Thanks.

brian
 
S

sowbug

Thanks for responding Tony, but the javac task doesn't support the
nested <fileset> element. Not even with the new version(1.6).
 
T

Tony Morris

sorry, you're right.
Reading up on the javac task reveals the following:

excludes Comma- or space-separated list of files (may be specified
using wildcard patterns) that must be excluded; no files (except default
excludes) are excluded when omitted.


which means you can't use <excludes> for excluding files.
But the solution:

excludesfile The name of a file that contains a list of files to
exclude (may be specified using wildcard patterns).


is quite trivial.

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)


sowbug said:
Thanks for responding Tony, but the javac task doesn't support the
nested <fileset> element. Not even with the new version(1.6).



"Tony Morris" <[email protected]> wrote in message
Use a <fileset>
http://ant.apache.org/manual/CoreTypes/fileset.html

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top