ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Gravitt <>
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

<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 -->
      	<fileset dir="${build}"> 
      		<include name="**/*.class"/>
  <target name="compile">
    <!-- Compile the java code from ${src} and place binaries in
    <javac srcdir="${src}/WEB-INF/classes" 
      <pathelement location="${build}/WEB-INF/classes"/>
      <pathelement location="${src}/WEB-INF/classes"/>
        <fileset dir="${src}/WEB-INF/lib">
	  <include name="**/*.jar"/> 

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


View raw message