ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krats <>
Subject Re: Ant picks class files from current directory rather than provided jar in classpath
Date Fri, 19 Feb 2010 22:42:06 GMT

Thanks a lot Jeffery. I looked at the documentation for javac and I guess it
does mention it.  But I was surprised because , instead of using ant, if I
directly use javac to compile , the behavior is what I would expect. So for
example in the case I mentioned, assuming source structure src\f1\
and src\f2\, if I already create f1.jar and put it in lib, and
assuming imports a class in,

if I do

javac -classpath lib\f1.jar f2\

then, it doesnt create f1\f1.class. Instead it uses the import f1 class from
the jar file. The class file for f1 gets created only when I the javac task
from ant. Thats why I was wondering if its an ant issue.

Again thx a lot for ur responses

Jeffrey E Care wrote:
> krats <> wrote on 02/19/2010 05:17:33 PM:
>> I am sorry about that. Dint know it was a user-list question. But we 
> have a
>> common src folder starting with package structure com.company_name and
>> subpackages within that maintained by different groups.
>> I might be wrong but I think it is a genuine requirement that I should 
> be
>> able to tell ant to first check a jar I am providing (which in my case 
> would
>> be jar of package com.company_name.f1 for example) to locate the imports
>> rather than check the source folder first. I was just wondering if 
> theres a
>> way to force ant to check provided jars first.
> Assuming I've understood your scenario correctly the docs for javac are 
> very clear: 
>     "Note: Classes found through the classpath may be subject to automatic 
> recompilation if their sources are also found."
> If you want separation, for whatever purpose, then have separate source 
> trees.

View this message in context:
Sent from the Ant - Dev mailing list archive at

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

View raw message