ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a1slowhand <ron_d...@yahoo.com>
Subject Re: Newbie question concerning ant javac
Date Mon, 01 Jun 2009 14:20:59 GMT

Thanks for the tips.  I liked the idea of the java compile options and will
use it.  i got the source and sub-source compiled worked out.  Since there
is not many sub-source applications, I just have a text file in each
sub-directory that is a list of excluded files to compile.   Compile snippet
follows:

  <target name="copy" depends="clean,create_dirs">
    <copy todir="${tmp}">
		<fileset dir="${tmpsrc}" casesensitive="no">
			<include name="/*.java"/>
			<excludesfile name="${basedir}\exclude.txt"/>
		</fileset>
	</copy>
	    <copy todir="${tmp}">
		<fileset dir="${source}" casesensitive="no">
			<include name="/*.java"/>
		</fileset>
	</copy>
  </target>



  <target name="compile" depends="clean,create_dirs,copy" >
    <javac destdir = "${basedir}/classes" compiler ="javac1.3"
executable="C:\jdk1.3\bin\javac" source="1.3" debug="on">
     <src path="${basedir}/tmp"/>  
      <classpath refid="class.path"/> 
    </javac>
    <copy todir="${basedir}/classes">
      <fileset dir="${basedir}">
        <include name="**/*.gif"/>
        <include name="**/*.jpg"/>
        <include name="**/*.png"/>
      </fileset>
      <fileset dir="${basedir}">
        <include name="reports/**/*.*"/>
      </fileset>
    </copy>
  </target>





a1slowhand wrote:
> 
> 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-tp23782206p23815694.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