ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Gravitt <Max.Grav...@sas.com>
Subject compiling one file at a time
Date Thu, 13 Sep 2001 14:22:40 GMT

How can I use ant to compile one file at a time?  I want to use ant
because I have filesets set up to construct the classpath, etc.  But
sometimes I just want to compile one file.  And of course, I'd like to
pass the file as a command line parameter.

I believe that this has to be done as a system property, but I'm not
sure what to put in the <javac> command to compile the file.

Also, I'd like the default behavior to be to compile everything, but
if the system property was passed in, only compile the file.

Is this possible?  If so, how is it done? 

Below is my current build.xml file.

thanks in advance
Max


<project name="itsv" default="compile" basedir=".">

  <!-- set global properties for this build -->
  <property name="src" value="."/>
  <property name="build" value="."/>
  <property name="dist" value="dist"/>
  
  <target name="clean">
      <!-- Delete binary files -->
      <delete>
      	<fileset dir="${build}"> 
      		<include name="**/*.class"/>
      	</fileset>
      </delete>
  </target>
  
  <target name="compile">
    <!-- Compile the java code from ${src} and place binaries in
${build}-->
    <javac srcdir="${src}/WEB-INF/classes" 
    	destdir="${build}/WEB-INF/classes"
	debug="on">
    <classpath>
      <pathelement location="${build}/WEB-INF/classes"/>
      <pathelement location="${src}/WEB-INF/classes"/>
        <fileset dir="${src}/WEB-INF/lib">
	  <include name="**/*.jar"/> 
	</fileset>
    </classpath>
    </javac>
  </target>

  <target name="javadoc">  
	<javadoc packagenames="com.sas.itsv.*"
sourcepath="${src}/WEB-INF/classes" destdir="${build}/doc"
windowtitle="IT Service Vision v3 Java API"/>
  </target>
  
  <target name="dist">
     <jar jarfile="${build}/WEB-INF/lib/itsv-${DSTAMP}.jar"
basedir="${build}/WEB-INF/classes"
    	includes="**/*.class"
    	excludes="**/*Test.class,
WEB-INF/classes/com/sas/itsv/test/**" />
         
     <!-- Put everything into a WAR file -->
     <war warfile="${dist}/itsv-production.war"
webxml="${build}/WEB-INF/web.xml">
     	<fileset dir="${build}">
     		<exclude name="WEB-INF/web.xml"/>
		<exclude name="WEB-INF/classes/***"/>
     	</fileset>
     </war>

  </target>
</project>

Mime
View raw message