开发者

Eclipse : Using same output folder for different projects

开发者 https://www.devze.com 2023-02-14 04:44 出处:网络
Following is a question that is posted on http://dev.eclipse.org in April 2003. The original question is:

Following is a question that is posted on http://dev.eclipse.org in April 2003. The original question is:

Hi all,

in eclipse i have created several java projects representing different modules for one web application. i'd like to configure one output folder for all of these projects. Any time i build a subproject the content of the output folder is deleted, so i loose the classes of all other subprojects.

I think there must be a switch or something like that to tell eclipse not to clear the content of the output folder when it builds a project - but i just can't find it.

Thanks for your help!

Alex

I am trying to see if I could get a definitve answer for this开发者_如何学编程 question. I have tried to find out to see if this question has already been addressed and I was not able to find any except for the following answer:

Window-->Preferences-->Java-->Compiler-->Build Path

The above answer did not help me much.


Hmm... I think this approach will bring more trouble than it's worth. Sure it's a priori a quick and dirty fix to integrating your projects together but you are only pushing the problem forward. It is good practice to keep your modules as isolated as possible from each-other, trying to merge the compiled code in a single location is working against the way the IDE was designed and will only bring trouble.

I would recommend that you look into maven to build and package your modules. Then referencing them is just a matter of adding a declaration in the project that requires it and you are integrated. Of course you will need to learn it but it provides a good base of conventions that when followed yield almost effortless integration. Plus reusing some modules in another project becomes trivial so you gain in all fronts.

To answer the other question in the thread when they wish to make a tree of related projects it is possible though somewhat clumsy. Eclipse will always present projects as a flat list, however the folders can be arranged in a tree nonetheless. Just specify a custom location when creating a project or import the project from the sub-folder. Again here Maven can help a lot with it's concept of modules.

As eugener mentioned in his comment, there are plugins for maven that will make most of these tasks trivial. You may find all you are looking for just by exploring the gui, this said, reading the maven literature will give you good insight on how it works and what it can do for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消