ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Cobban" <>
Subject How do you use destdir in javac task?
Date Mon, 27 Jan 2003 23:25:11 GMT
I am clearly misunderstanding the documentation.  I am trying to move to ant from a configuration
where I was using a .bat file to compile my program.  My classes are all in the Census package
so I have a directory containing the source which has a subdirectory of Census which contains
the compiled classes.  The documentation on the javac task specifically mentions the need
to have the directory structure mirror the package hierarchy.

So exactly what do I put in the destdir attribute?  I assumed that I had to point at the top
of the package hierarchy, so I put "." there, but that doesn't work.  So I put in "Census"
but then it creates "Census/Census" and puts the classes one level too deep.  I am clearly
doing something wrong because every time I run ant it indicates that it is compiling every
one of my programs, even if it has just finished compiling them.

<project name="CensusUtility" default="compile" basedir=".">
        build the Census database maintenance utility
  <!-- set global properties for this build -->
  <property name="src" location="."/>
  <property name="classes" location="Census"/>

  <target name="compile"
   description="compile the source " >
    <depend srcdir="${src}" destdir="${classes}" />
    <!-- Compile the java code from ${src} into ${classes} -->
    <javac srcdir="${src}" destdir="${classes}" 

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Put everything in ${classes} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="CensusUtility-${DSTAMP}.jar" basedir="${classes}"/>


Jim Cobban
34 Palomino Dr.
Kanata, ON, CANADA
K2M 1M1
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message