ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krats <princekart...@gmail.com>
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\f1.java
and src\f2\f2.java, if I already create f1.jar and put it in lib, and
assuming f2.java imports a class in f1.java,

if I do

javac -classpath lib\f1.jar f2\f2.java

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 <princekarthik@gmail.com> 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: http://old.nabble.com/Ant-picks-class-files-from-current-directory-rather-than-provided-jar-in-classpath-tp27658759p27661343.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message