You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Alves <da...@brnphoenix.com> on 2007/05/26 03:12:12 UTC

Assembling src files in multiple directories for compilation

I have a project that looks like this:

 

/folder1/src

/folder2/src

/folder3/src

/folder4/src

/folder5/src

/build/src

/build/classes

 

Currently, I copy all of them to /build/src before compiling them all
into /build/classes I'm wondering if it's possible to do this without
the copy step. So I'd like to compile the files in /folder1/src,
/folder2/src, and stick the output into /build/classes. The problem is
that the code in each of those folders can depend on code in any of the
other ones, so they can't just be compiled separately. 

 

Is there a way to do this?  It seems like I need a way to define a set
of filesets, but I don't know of a way to do that. Incidentally, the
number of folders with source code inside them is going to stay at 5. So
I don't need a way to find */src directories, I just need a way to
hardcode those 5 into fileset-type group.

 

Thanks in advance for your help!

 

Regards,

David Alves


Re: Assembling src files in multiple directories for compilation

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Yep - you can do it...

It's all right there in the <javac> online docs :)

Here is one example:

  <javac destdir="${build}"
         classpath="xyz.jar"
         debug="on">
    <src path="${src}"/>
    <src path="${src2}"/>
    <include name="mypackage/p1/**"/>
    <include name="mypackage/p2/**"/>
    <exclude name="mypackage/p1/testpackage/**"/>
  </javac>

So, just in defining your example:

<javac destdir = "build/classes">
    <src path = "/folder1/src"/>
    <src path = "/folder2/src"/>
    <src path = "/folder3/src"/>
    <src path = "/folder4/src"/>
</javac>

Of course, this is just me whipping out an answer "right quick" (as the 
say in NC) - your mileage may very :)

HTH,

Scot

David Alves wrote:
> I have a project that looks like this:
>
>  
>
> /folder1/src
>
> /folder2/src
>
> /folder3/src
>
> /folder4/src
>
> /folder5/src
>
> /build/src
>
> /build/classes
>
>  
>
> Currently, I copy all of them to /build/src before compiling them all
> into /build/classes I'm wondering if it's possible to do this without
> the copy step. So I'd like to compile the files in /folder1/src,
> /folder2/src, and stick the output into /build/classes. The problem is
> that the code in each of those folders can depend on code in any of the
> other ones, so they can't just be compiled separately. 
>
>  
>
> Is there a way to do this?  It seems like I need a way to define a set
> of filesets, but I don't know of a way to do that. Incidentally, the
> number of folders with source code inside them is going to stay at 5. So
> I don't need a way to find */src directories, I just need a way to
> hardcode those 5 into fileset-type group.
>
>  
>
> Thanks in advance for your help!
>
>  
>
> Regards,
>
> David Alves
>
>
>   

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

252-478-8087 (Home)
919-392-6730 (Work)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org