Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: How to compile co-dependent files

Scot P. Floess

2008-02-21

Replies: Find Java Web Hosting

Author LoginPost Reply
Understood... But, as Dimitris pointed out you usually put your
build/classes dir in your classpath. Additionally, you probably want
to include the source directory in the sourcepath section of the
javac task...

To be honest I'm not sure you are structuring your build.xml correctly
or perhaps your source tree is scattered throughout different directories?

Usually for me, I have something like this:

projectdir
 src
   java
 build

So, I compile everything from src/java - having classes generated to the
build dir

Never do I try to compile a .java one at a time or a package at a
time... I usually let the javac task do the hard work. The only time I
deviate is when I have tasks that generate Java code (for example
Javacc). In that case I generate Java code first (to a known directory)
and include that directory as well as the Java source directory in the
sourcepath for the Javac task.

This is sorta why I was trying to see your build.xml... I don't exactly
understand how it is you have defined your build.xml or why your targets
reference different classes? Usually targets perform some task - for
example generate, compile and document...

mojoRising wrote:
> I solved my problem for the time being by refactoring my classes to adhere to
> a strict convention whereby the compile order is A,B,C and the observed
> convention is:
>
> target A requires no other classes - (just simple display objects)
> target B references classes in A only - (EJBs)
> target C can reference classes in A or B - (utility/controllere beans)
>
> But, my original question was: Is it possible for classes in A to reference
> classes in B or C? Or classes in B to reference classes in C? etc. etc.
>
> I wanted to spare everyone the burden of including my build file as I think
> my question is more general than specific. Thanks!
>
>
>
> mojoRising wrote:
>  
>> Hi. I am new to using ANT and hope someone can help me with this, I am
>> sure most basic, question which has confounded me.
>>
>> I have 2 targets. Each target contains a file that has references to a
>> class in the other target. I can't build successfully because the first
>> target can never compile since the second target hasn't been built yet.
>>
>> What am I doing wrong?
>>
>> Thanks so much for anyhelp you can offer -
>>
>> John
>>
>>  
>
>  

--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim

Architect Keros       http://sourceforge.net/projects/keros

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.