Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2004

Tip: Looking for answers? Try searching our database.

Ant not excluding on javac task

Thread view: 
sowbug - 21 Jan 2004 18:43 GMT
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
sowbug - 22 Jan 2004 16:20 GMT
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

> My script will exclude whole directories in the javac task, but it
> will not exclude individual files from being compiled.  Can someone
[quoted text clipped - 94 lines]
>
> </project
Tony Morris - 22 Jan 2004 22:26 GMT
Use a <fileset>
http://ant.apache.org/manual/CoreTypes/fileset.html

Signature

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

> 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
[quoted text clipped - 46 lines]
> > location="${java_dir}"/></classpath>
> >             <classpath><pathelement

location="${project_dir}j2sdk1.4.1/lib/ext/AbsoluteLayout.jar"/></classpath>
> >             <include name="com/"/>
> >         </javac>
[quoted text clipped - 4 lines]
> > 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>
[quoted text clipped - 39 lines]
> >
> > </project
sowbug - 24 Jan 2004 02:50 GMT
Thanks for responding Tony, but the javac task doesn't support the
nested <fileset> element.  Not even with the new version(1.6).

> Use a <fileset>
> http://ant.apache.org/manual/CoreTypes/fileset.html
Tony Morris - 26 Jan 2004 03:30 GMT
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.

Signature

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

> Thanks for responding Tony, but the javac task doesn't support the
> nested <fileset> element.  Not even with the new version(1.6).
>
> > Use a <fileset>
> > http://ant.apache.org/manual/CoreTypes/fileset.html


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.