Reg : Single Source Multiple Output Folders in Eclipse

89 views
Skip to first unread message

Sathish Kumar

unread,
Apr 13, 2009, 2:48:46 AM4/13/09
to bo...@googlegroups.com
Hi,

I have a doubt in the Eclipse Project setup. Is it possible to add Multiple Output folders to single source folders? ie. Consider we have the below directory structure
  • src - ( Java files will be available here )
  • bin1
  • bin2
I want to compile 'src' folder and copy the compiled classes into both 'bin1' and 'bin2'. Is is possible ?

Thanks in Advance.

Regards,
Sathish Kumar T

Amit Saha

unread,
Apr 14, 2009, 1:41:32 AM4/14/09
to bo...@googlegroups.com
On Mon, Apr 13, 2009 at 12:18 PM, Sathish Kumar
<sathishkumar...@gmail.com> wrote:
> Hi,
>
> I have a doubt in the Eclipse Project setup. Is it possible to add Multiple
> Output folders to single source folders? ie. Consider we have the below
> directory structure
>
> src - ( Java files will be available here )
> bin1
> bin2
>
> I want to compile 'src' folder and copy the compiled classes into both
> 'bin1' and 'bin2'. Is is possible ?

How about modifying the 'build.xml' file? You will probably have to do
it in the <post-jar> (or something like that). Sorry, I don't
remember the exact stuff.

-Amit
--
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in

"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion

Pankaj Agrawal

unread,
Apr 14, 2009, 8:53:11 AM4/14/09
to sathishkumar...@gmail.com, bo...@googlegroups.com
Hi Sathish,
I am also agree with Amit,
I think in build script you can mention your compiled destination folder like this.

<javac source="1.5"  srcdir="${src}" destdir="classes1">
                  </javac>

<javac source="1.5" srcdir="${src}" destdir="classes2">
                  </javac>

Regards
Pankaj

On Mon, Apr 13, 2009 at 12:18 PM, Sathish Kumar <sathishkumar...@gmail.com> wrote:

Raghavan.30May1981_GMail

unread,
Apr 15, 2009, 8:21:00 AM4/15/09
to bo...@googlegroups.com, sathishkumar...@gmail.com
Of course, it is possible and should be.

Its been years I worked in eclipse (I last worked on Eclipse 3) and now they are somewhere to a greater extent (Ganymede etc.,).

A simple solution would be : override the default task done be eclipse! -- by inserting your second destination directory via the possible modes.

I tried in simple Ant and in command mode! -- You can try the same in the build.xml of your project.

Option #1: Tried inserting the second destination directory separated by comma in "destdir" attribute of <javac> task. [<javac src="${src}" destdir="${dest.dir.1}, ${dest.dir.2}"/>.  It did NOT work and threw an error. Ideally speaking it should work as it works fine with my "javac" executable in command prompt. AOK (Ant Only Knows).

Option #2a: Duplicate the <javac> task in the build.xml with the different value for "destdir" attribute in <javac> task as follows:
        <javac srcdir="${src.dir}" destdir="${dest.dir.1}"/>
        <javac srcdir="${src.dir}" destdir="${dest.dir.2}"/>

Option #2b: Needless to say, write a <copy> task to copy *.class files from ${dest.dir.1} to ${dest.dir.2} :)

Hope this helps!

Cheers,
Raghavan alias Saravanan M.
http://groups.google.com/group/S_H_a_D_E

"Everything has got its own deadline including one's EGO" - Raghavan alias Saravanan M.
Reply all
Reply to author
Forward
0 new messages