my dog learned polymorphism*
The moose likes IDEs, Version Control and other tools and the fly likes complex source directories in Eclipse Projects? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "complex source directories in Eclipse Projects?" Watch "complex source directories in Eclipse Projects?" New topic
Author

complex source directories in Eclipse Projects?

Marina Popova
Greenhorn

Joined: Jul 20, 2001
Posts: 11
Hi!
I have used JBuilder in the past and decided to try Eclipse as I've heard
very good reviews about it.
I have tried to set up a Project and map it to existing directories as described in the manual on "Overlapping products in a common source tree" .
My directories are organized as described in the above mentioned manual :
src
-- root1
-- a
-- b
...
-- root2
...
-- rootN
I have about 40 subdirectories under "root1", their packages are
"root1.a", "root1.b" and so on. I wanted to create a project for "root1.a"
package only.
One problem I encountered right away is that I had to explicitely add all
40 other subdirectories to the "Exclusion Patterns" list, as well as all
siblings of the root1 dir. No need to say it is very painfull to do that for so
many directories... Why could not I specify just one directory to be included into the project? Even after I did all this exclusion excercise, after opening my project, I still see all other directories in the "Project Explorer" under "src'. Why? Have not I excluded them all just now??
I did try a different approach and tried to specify just one directory "src/root1/a" as the source directory - but then Eclipse complains that my directory and package structure are incompatible. I guess it figured out that the package of all Java files was "root1.a" and tried to append it to the source directory...
After doing this I really appreciated JBuilder's ease of adding directories/files to the projects... You create a new project there and
then just do "Add files..." to your project from any directory and it is smart enough to figure out what package they are in and add the whole
directory to the project...
I still hope that it is rather my inexperience with Eclipse that prevents me from creating projects this way. Could somebody explain what I did wrong in setting up this project?
Another problem I found is when I tried to define the "WEBLOGIC610" classpath variable. It shows the default value of "C:/....". No matter how
many times I tried to edit it - next time I examine the classpath variable the old value is there again, and Lomboz (a J2EE plugin) is using the wrong value in its Server Definitions...
Any help would be greatly appreciated,
thanks,
Marina
Simes Brown
Greenhorn

Joined: May 14, 2003
Posts: 6
Originally posted by Marina Popova:

After doing this I really appreciated JBuilder's ease of adding directories/files to the projects... You create a new project there and
then just do "Add files..." to your project from any directory and it is smart enough to figure out what package they are in and add the whole
directory to the project...
I still hope that it is rather my inexperience with Eclipse that prevents me from creating projects this way. Could somebody explain what I did wrong in setting up this project?

Have you tried using the Import wizard? Create a new project, right click the project's source folder (if there is one, otherwise right click the project), choose "Import...", and "File System", then import the directories you want.

Another problem I found is when I tried to define the "WEBLOGIC610" classpath variable. It shows the default value of "C:/....". No matter how
many times I tried to edit it - next time I examine the classpath variable the old value is there again, and Lomboz (a J2EE plugin) is using the wrong value in its Server Definitions...

I don't see this problem. Which version of Eclipse are you using?
Simes.
Marina Popova
Greenhorn

Joined: Jul 20, 2001
Posts: 11
Thanks for the advise!
Unfortunately, "Import..." did not help - it imported not only the directory I needed but the whole directory hierarchy also (although I explicitely specified only one directory to include...)
As to the WEBLOGIC610 classpath variable. I'm using Eclipse 2.1.0 version on Solaris, and I think that might be a problem. In my Windows version, there is an option to set the classpath variable in the Lomboz Properties directly, but in the Solaris version there is no such option at all and I have to set it through the Windows -> Java -> Classpath Variables screeen (which does not work for me).
Well, it looks like Eclipse is great when you start new projects and are flexible about source directories, but it is not very intuitive when you have to integrate it with existing projects. At this point I dont' think I can afford spending more time on this and will probably try IDEA or go back to JBuilder and maybe try a later version of Eclipse some time in the future.
Thanks for your help anyway!
Marina
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
Don't give up yet! I believe all you need to do is:
1. Create a new project called, just for example, root1.a (File > New > Java > Java Project).
2. Right click the project and select New > Folder.
3. Call the new folder root1. Don't press Finish yet.
4. Select Advanced, turn on the Link to folder in the file system option, and type or browse to the location of the real root1 folder. Now press Finish.
5. Right click the project, select Properties > Java Build Path > Source. Expand the source folder and double click the Exclusion filter.
6. Select Add Multiple. Expand root1 and select all its immediate children except for a. (on Windows you do this by clicking on the first one, shift-clicking on the last one, and control-clicking on any in the middle to toggle). Then press OK a few times to get out of all the dialogs.
That's it!
The linking feature is similar to NetBeans' virtual filesystem but should be familiar to Unix users used to symbolic links. And no matter how many directories you need to exclude it's only one step to exclude them all at once.


Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
Himanshu Pathak
Greenhorn

Joined: Apr 26, 2004
Posts: 9
hi,
after using JCreater LE for a while i have decided to give eclipse a try.
this could be a very simple issue for the experienced eclipse users and i am hoping a reply soon.
i am creating a servlet aplication using tomcat.
my directory structure is like this
TOMCAT_HOME\webapps\myapplication
src java files are ocated at
TOMCAT_HOME\webapps\myapplication\WEB-INF\src
and the compiled classes i want to put
TOMCAT_HOME\webapps\myapplication\WEB-INF\classes\mypackage\
when i am trying to give these folders as source folder and output folder in eclipse it gives an error saying
can not create a link because it overlaps the location of the project that contains the linked resourc.

can anyone explain me wht exactly i should specify as source and output folder
Ravi Raghava
Greenhorn

Joined: Feb 22, 2004
Posts: 7
Originally posted by Ed Burnette:
Don't give up yet! I believe all you need to do is:

1. Create a new project called, just for example, root1.a (File > New > Java > Java Project).

2. Right click the project and select New > Folder.

3. Call the new folder root1. Don't press Finish yet.

4. Select Advanced, turn on the Link to folder in the file system option, and type or browse to the location of the real root1 folder. Now press Finish.

5. Right click the project, select Properties > Java Build Path > Source. Expand the source folder and double click the Exclusion filter.

6. Select Add Multiple. Expand root1 and select all its immediate children except for a. (on Windows you do this by clicking on the first one, shift-clicking on the last one, and control-clicking on any in the middle to toggle). Then press OK a few times to get out of all the dialogs.

That's it!

The linking feature is similar to NetBeans' virtual filesystem but should be familiar to Unix users used to symbolic links. And no matter how many directories you need to exclude it's only one step to exclude them all at once.



Ed,
I was looking for a good solution for this classpath problem.. Your solution seems to be working.. Thank you..


Ravi Raghava
SCJP
SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: complex source directories in Eclipse Projects?
 
Similar Threads
Wanted: Java Tutorial (Book) that uses Eclipse
Question on javadoc
Importing Eclipse project in to MyEclipse 6.6
is it a bug or somethingelse?
Eclipse vs NetBeans