Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

javac from ant fails to compile two source directories

Thread view: 
timasmith@hotmail.com - 23 Mar 2006 03:32 GMT
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
alexandre_paterson@yahoo.fr - 23 Mar 2006 15:33 GMT
Hi there,

> Hi,
>
[quoted text clipped - 14 lines]
>
> 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
timasmith@hotmail.com - 23 Mar 2006 16:06 GMT
thanks, I realized Eclipse was masking compilation errors because it
was referencing an old jar.

Once it compiled my ant worked.

thanks


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.