Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > javac from ant fails to compile two source directories

Reply
Thread Tools

javac from ant fails to compile two source directories

 
 
timasmith@hotmail.com
Guest
Posts: n/a
 
      03-23-2006
Hi,

I have

<target name="compile" depends="prepare">
<javac destdir="${build.dir}" classpathref="build.classpath"
debug="on">
<src path="${framework.dir}:${src.dir}"/>
</javac>
</target>

The files in the src.dir

com.mysite.myapp...

are dependent on the framework files

com.mysite.myframework...

and everything compiles ok in Eclipse though I had to create a build
path source link which was a little strange but worked.

How can I compile two directories with one dependent on the other?

thanks

Tim

 
Reply With Quote
 
 
 
 
alexandre_paterson@yahoo.fr
Guest
Posts: n/a
 
      03-23-2006
Hi there,

wrote:
> Hi,
>
> I have
>
> <target name="compile" depends="prepare">
> <javac destdir="${build.dir}" classpathref="build.classpath"
> debug="on">
> <src path="${framework.dir}:${src.dir}"/>
> </javac>
> </target>
>
> The files in the src.dir
>
> com.mysite.myapp...
>
> are dependent on the framework files
>
> com.mysite.myframework...

....
> How can I compile two directories with one dependent on the other?


You don't have circular dependencies right? (which would be very
ugly).

Then you can simply call Ant's javac task twice from your compile
target.

For example, if you'ge got a ${myapp.dir} defined :

<target name="compile" depends="prepare">
<javac destdir="${build.dir}" classpathref="build.classpath">
<src path="${framework.dir}:${src.dir}"/>
</javac>
<javac destdir="${build.dir}" classpathref="build.classpath">
<src path="${myapp.dir}:${src.dir}"/>
</javac>
</target>


This will work if "myapp" depends on "framework" but not the other
way round. Note that you must call javac on your "framework" first,
otherwise it won't work. Note also that you must use the same destdir.

This is relatively simple and straightforward, but there may be other,
better, ways to do it, which I leave to other posters to explain,

Alex

 
Reply With Quote
 
 
 
 
timasmith@hotmail.com
Guest
Posts: n/a
 
      03-23-2006
thanks, I realized Eclipse was masking compilation errors because it
was referencing an old jar.

Once it compiled my ant worked.

thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ant javac exclude not working for directories dtown22@gmail.com Java 1 03-22-2007 09:34 PM
Ant not excluding on javac task sowbug Java 4 01-26-2004 03:30 AM
ant javac source alternative John Green Java 0 12-04-2003 02:04 AM
Ant javac : How to print classpath? Ronald Fischer Java 1 09-19-2003 01:13 AM
Re: Problem with ant's javac task z3 Java 0 07-23-2003 06:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57