ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: probably the last one on Java Dependencies.
Date Fri, 15 Jun 2001 18:09:06 GMT
Your "srcdir" should point up to the directory just before your package
hierarchy begins. Your "destdir" can point to wherever you want the output
files to go, but you don't need to include the package-hierarchy structure
in it. For example, if your work area is laid out like:

  /viraj/work/src/com
                    |
                    foo     bar     blat
                     |       |       |
                  Foo.java  baz    Blat.java
                             |
                          Baz.java

then your "srcdir" attribute should point to /viraj/work/src. Let's say
you want the classfiles to go under /viraj/work/build/classes, then your
"destdir" would point there, and when you run your compiles, assuming
Foo.java has a "package com.foo;" statement, Baz.java has a "package
com.bar.baz;", and Blat.java has a "package com.blat;", the classfiles
will go into:

  /viraj/work/build/classes/com/foo/Foo.class
  /viraj/work/build/classes/com/bar/baz/Baz.class
  /viraj/work/build/classes/com/blat/Blat.class
  
You need to <mkdir> the /viraj/work/build/classes directory, but the
compilation process itself will create the package-structure
subdirectories and put the classfiles into that structure. If the .java
files were in a package-like directory structure, but didn't include the
corresponding package statements, then the classfiles would go into the
"destdir" itself, not into package-structure subdirs, and <javac> wouldn't
be able to find them -- unless you specified the "srcdir" attribute to be
the full-path to the directory the source-files lived in.

Diane

--- Viraj Purang <viraj_purang@spincircuit.com> wrote:
> Hi Diane,
> 	There is probably one last bit to the priblem that I was talking
> about for dependencies, I did see that if put my dest dir with the 
> package
> structure like 
> <javac   srcdir="." destdir="${cpath}/com/spincircuit/utils"
> depend="off"
> verbose="on"
>  
>
classpath="${symbeans.jar}:${jsdk.jar}:${activation.jar}:${xerces.jar}:${ser
> vlet.jar}......"
>              deprecation="off" debug="on" optimize="off" target="1.2"
> in the first iteration it picks up the class files from the right
> location
> and gives me info like the following : 
> 
>     [javac] ErrorMessage.java omitted as
>
C:\CVS1\builder\client\build\classes\com\spincircuit\utils\ErrorMessage.clas
> s is up 
>     [javac] Mail.java omitted as
> C:\CVS1\builder\client\build\classes\com\spincircuit\utils\Mail.class is
> up
> to date.
>     [javac] MailException.java added as
>
C:\CVS1\builder\client\build\classes\com\spincircuit\utils\MailException.cla
> ss is outdated.
>     [javac] Compiling 1 source file to
> C:\CVS1\builder\client\build\classes\com\spincircuit\utils
>     [javac] Using classic compiler
> 
> which is what I want finally.
> But now because of the packaging statement inside the java file the
> output
> goes into ...
> ${cpath}/com/spincircuit/utils/com/spincircuit/util...
> 
> I know of no option in Java that turns this packaging attachment to
> "off".
>    This leaves me 1 option (albeit a dirty one) ... to maually copy the
> directory 
>      ${cpath}/com/spincircuit/utils/com/spincircuit/utils... into
> ${cpath}/com/spincircuit/utils, unless youknow of a better solution ...
> 
> The issue would not exist if I did not have a packaging structure ...but
> that is highly unlikely.
> 
> 
> Regards,
> Viraj Purang
> 
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/

Mime
View raw message