ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject <javac> support for tree without package names?
Date Tue, 27 Feb 2001 01:51:58 GMT
Hello,

I'm confronted with trying to compile a directory tree of sample code
where the .java files don't use packages.  Like this:
 samples
   Topic1
     sample1
       sample1.java
     sample2
       sample2.jara
   Topic2
     sample1
       sample1.java
     sample2
       sample2.jara
   etc.

My <java> looks like this:
    <javac srcdir="${src.dir}"
           destdir="${src.dir}"
           debug="${javac.debug}"
           deprecation="${javac.deprecation}"
           optimize="${javac.optimize}"
           classpathref="classpath" />
where src.dir is set to "."

If I cd into a subdirectory like Topic1/sample1 and run ant -find
build.xml, it finds the build.xml in the samples root directory but runs
javac with a -d option pointing to the samples root directory instead of
the current directory.  It seems the destdir is relative to the build.xml
and not the current directory.  I verified Ant 1.2 also works this way. 
The end result is that all the files under samples are compiled and the
.class files written to the root samples directory itself instead of the
relative directory.  The end result is it appears there needs to be one
<javac> task per subdirectory so the srcdir and destdir can be specified
appropriately for each one.

The only reasonable way I've been able to get Ant (1.3beta3) to work under
this configuration is by having one build.xml at each of the Topic1,
Topic2 levels, etc. subdirectories.  Instead of defining one <javac> task
for each subdirectory, I'm using a series of <antcall>'s to call a
"compile_template" target for each subdirectory containing one or more
.java files.

At the moment, converting these samples to use packages doesn't seem
feaseable due to other unrelated issues.

Does anyone have any suggestions?

Thanks,
-Bill

Mime
View raw message