You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Quinn <mi...@onaustralia.com.au> on 2001/08/18 07:57:22 UTC

MORE:javac fails inside ANT Compilation of dependent files

Hello all, have sort of resolved the issue, but not quite

    Remember
    
                 test
          proj1          proj2  (build.xml in here)
            |              |
           com            com
            |              |
            a              c
            |              |
            b              d
            |              |
           callee.java   caller.java

    If classpath points to proj1, and I build caller.java from command line, all 
    is fine as the javac compiler finds callee.java via classpath, and builds callee.class
    as needed

    From ANT this fails, even if I set classpath and srcdir correctly

    Ant works fine when I have the following, with srcdir set at proj2, but this is not what I want,
    I want the same behaviour as javac from the command line (above)

                             proj2 (build.xml here, only building caller.java)
             |
                     ____ com _____           
         |               |
         a               c
         |               |
         b               d
         |               |
     callee.java      caller.java


Can somebody help ??

cheers Michael Quinn


Re: MORE:javac fails inside ANT Compilation of dependent files

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Michael,

You need to provide a source path with both the proj1 and proj2
directories. You can either do that by using a path construction in the
srcdir attribute or by using a <src> nested element with multiple path
elements - so

<javac srcdir="proj1:proj2">

or

<javac>
  <src>
     <pathelement location="proj1"/>
     <pathelement location="proj2"/>
  </src>
</javac>

I haven't tried the above - just from memory so may need some adjustment.
Check the manual.

I am curious however how javac is working from the commandline. I am
guessing it is something to do with classpaths. You can run ant
with -verbose to see the equivalent command line Ant is generating for
javac. Check that out and see where it is different from your manual
invocation.

Conor

----- Original Message -----
From: "Michael Quinn" <mi...@onaustralia.com.au>
To: <an...@jakarta.apache.org>
Sent: Saturday, August 18, 2001 3:57 PM
Subject: MORE:javac fails inside ANT Compilation of dependent files


Hello all, have sort of resolved the issue, but not quite

    Remember

                 test
          proj1          proj2  (build.xml in here)
            |              |
           com            com
            |              |
            a              c
            |              |
            b              d
            |              |
           callee.java   caller.java

    If classpath points to proj1, and I build caller.java from command
line, all
    is fine as the javac compiler finds callee.java via classpath, and
builds callee.class
    as needed

    From ANT this fails, even if I set classpath and srcdir correctly

    Ant works fine when I have the following, with srcdir set at proj2, but
this is not what I want,
    I want the same behaviour as javac from the command line (above)

                             proj2 (build.xml here, only building
caller.java)
             |
                     ____ com _____
         |               |
         a               c
         |               |
         b               d
         |               |
     callee.java      caller.java


Can somebody help ??

cheers Michael Quinn