ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carl Dreher <>
Subject Can't get even the first thing to work
Date Sun, 11 Aug 2002 20:23:27 GMT
I'm trying to learn Ant and thought I'd start by getting it to do just
the simplest possible thing...compile ONE file.

The problem in a nutshell is that when I run Ant, it appears that the
javac compiler can't see other files in the same package.

For example, here is the project directory structure:


Within the 'sql' directory is a single file called SQLFormatter that
has, as its first 3 lines:
   package sql;
   import sql.*;
   import util.*;

Here's the Ant build file, which resides in the 'src' directory.
<project name="project" default="compile" basedir=".">
   <path id="MyProject.path">
      <fileset dir="d:\jakarta\jakarta-tomcat-4.0.4\common\lib">
         <include name="**/*.jar"/>
   <property name="outputDir" value="classes" />

   <!-- create a new, temporary output directory -->
   <target name="prepare">
      <mkdir dir="${outputDir}" />

   <target name0="compile" depends="prepare">
     <javac srcdir="sql" destdir="${outputDir}">
       <classpath refid="MyProject.path"/>

That's it!  All I want it to do is build one Java file in the sql
directory.  The error reported is:

    [javac] D:\LSR\src\sql\ package util does not
    [javac] import util.*;
    [javac] ^

Yet, I can do to the command line and type:
  c:\MyProject\src> javac sql\
and it compiles fine.

Isn't Ant suppose to be doing exactly the same thing?  Why does the
javac compiler fail to find the 'util' directory when using Ant?  Should
the build file be somewhere other than the 'src' directory?

I read the ANT documentation.  (Awful, really, really awful.)  Bought
the "Ant Definite Guide" book.  (Total waste of time and money.)  Looked
at the archives of the mailing list.  (No help.)  Maybe someone live on
this list can help.

- Carl D.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message