ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a1slowhand <>
Subject Newbie question concerning ant javac
Date Fri, 29 May 2009 15:35:27 GMT

My company is just now moving to Ant and I have been given the task of moving
it.  I have been able to compile our main source directory, so I know I have
Ant installed and working propertly. We have our based code, and then custom
code underneath that narrows the based code. My problem is how to select
"certain" source files for the compile.  

|TopSrc source dir  <-- based code
|--|CustomerXX <-- narrowed code
|--|CustomerYY <-- another customer code narrowed

What I would like to do is after making the changes to CustomerXX\
compile grabbing TopSrc\  & TopSrc\ &
TopSrc\CustomerXX\, and ensuring that TopSrc\ is NOT selected to
advoid a duplicate class error from the compile.  Similar process would
happen when changing CustomerYY's code.  I only need to compile the Customer
that changed.  The closest that I have come is to compile source directory
and all sub-directories.  Which Javac complains of duplicate classes when it
compiles one of the sub-directories java apps with the same name as one in
the root source directory.

<project name="AAAtest" default="make_jar" basedir=".">
 	<property name="source" location="C:\Documents and Settings\Ron\TopSrc"/>
	<property name="build" location="C:\Documents and Settings\Ron\TopSrc"/>
	<property name="dist"  location="dist"/>
<!--  Which customer -->
		message="Please enter the Customer to build:"

	<path id="class.path">
		<fileset dir="lib">
		<include name="**/*.jar"/>

  <target name="init">
     <property name="project_name"   value="auction"/>
     <property name="jar"           
     <property name="mainclass"      value="myTest"/>
     <property name="DataDir"  value="${basedir}/${build.cust}/data"/>

  <target name="create_dirs" depends="init">
    <mkdir dir="${basedir}/${build.cust}/classes"/>
    <mkdir dir="${basedir}/${build.cust}/lib"/>
    <mkdir dir="${basedir}/${build.cust}/jar"/>

  <!-- CLEAN TARGET -->
  <target name="clean">
    <delete dir="${basedir}/${build.cust}/classes"/>

  <target name="compile" depends="clean,create_dirs">
    <javac destdir = "${basedir}/${build.cust}/classes" source="1.3"
      <src path="${basedir}"/>
      <exclude name="**/_*.java"/>
      <classpath refid="class.path"/> 
    <copy todir="${basedir}/${build.cust}/classes">
      <fileset dir="${basedir}/${build.cust}">
        <include name="**/*.gif"/>
        <include name="**/*.jpg"/>
        <include name="**/*.png"/>
      <fileset dir="${basedir}/${build.cust}">
        <include name="reports/**/*.*"/>

  <!-- MAKE JAR TARGET -->
  <target name="make_jar" depends="compile">
    <jar basedir="${basedir}/${build.cust}/classes" 
    <copy todir="${basedir}/${build.cust}/jar">
      <fileset dir="${basedir}/${build.cust}/lib">
        <include name="**/*.jar"/>


Any help at this point would be great!  Even if it's to point me to the
right place in the manual.  I have no problem reading and studing, but the
terminology Ant uses is not what I know.  That makes it hard to lookup the
task I'm trying to accomplish.

Thanks to all.

View this message in context:
Sent from the Ant - Users mailing list archive at

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

View raw message