ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: compiling one file at a time
Date Thu, 13 Sep 2001 14:29:42 GMT
On Fri, 14 Sep 2001 00:22, Max Gravitt wrote:
> 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?

I think something like

<javac ...>
  <exclude name="**/*" unless="java.file"/>
  <include name="${java.file}"/>
</javac>

then ant -Djava.file=com/biz/Foo.java

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

-- 
Cheers,

Pete

---------------------------------------------------
"Therefore it can be said that victorious warriors 
win first, and then go to battle, while defeated 
warriors go to battle first, and then seek to win." 
              - Sun Tzu, the Art Of War
---------------------------------------------------

Mime
View raw message