ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bemowski, Paul A" <>
Subject RE: java and corresponding class files comparsion before build.
Date Wed, 30 Aug 2000 14:49:41 GMT

I had a similar problem.  I looked at the source for the javac task to
figure it out.

If your package structure is x:/src/com/xxx/exception/ then you should set
the srcdir of the javac command to x:/src.  If you only want to compile the
code in the com/xxx/exception package, use the includes and excludes tags.  

This has to do with some assumptions that ant has to make to do the
necessary class/java file comparisons.

Paul Bemowski
Z-Tel Communications

-----Original Message-----
From: sdeva []
Sent: Wednesday, August 30, 2000 10:46 AM
Subject: java and corresponding class files comparsion before build.

Consider the following target,

<target name="mypackage\exception" depends="prepare">
    <javac srcdir="mypackage\exception"

with build set to c:\temp and basedir set to c:\test

Here I am trying to compile java files in mypackage\exception from c:\test
into c:\temp  and the sourcefiles contain the list of sources to be
compiled.  When Ant is run for the first time on this target, it picks files
from sourcefiles and compiles them fine. C:\temp\mypackage\exception\*.class
contains all the classes I need. But, next time I run ant (without cleaning
my build area), I expected ant to do nothing as the targets are already
up-to-date. But, what happened is ant rebulild the targets again. 

I suspect that the comparison is happening without including the package of
the java file. Something like c:\test\mypackage\exception\ with
c:\temp\A.class. If I change my target to the one below everything works
fine ( I hope, I have not tested it yet),

<target name="mypackage\exception" depends="prepare">
    <javac srcdir="." includes="mypackage\exception\*.java"

But the catch here, is the sourcefiles should contain files listed with
package name. For example, should be listed as
mypackage\exception\ in sourcefiles.  I have to go and change around
30 modules in my project to contain package names in their list of sources
in sourcefiles. 

Is this the only way or  is there some other way to hint ant for correct
comparsions including package names.

Any thoughts,


Srinivas Devarakonda.

View raw message