ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a1slowhand <ron_d...@yahoo.com>
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
|    main.java
|    a.java
|    b.java
|--|CustomerXX <-- narrowed code
|--    b.java
|--|CustomerYY <-- another customer code narrowed
|--    a.java
|--    b.java

What I would like to do is after making the changes to CustomerXX\b.java
compile grabbing TopSrc\main.java  & TopSrc\a.java &
TopSrc\CustomerXX\b.java, and ensuring that TopSrc\b.java 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 -->
	<input
		message="Please enter the Customer to build:"
		addproperty="build.cust"
		defaultvalue="AAAtest"
	/>

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

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

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

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

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


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

</project>


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.
Ron




-- 
View this message in context: http://www.nabble.com/Newbie-question-concerning-ant-javac-tp23782206p23782206.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message