views:

182

answers:

2

What do you guys do, when you have huge project built with ant for instance, where the source folders are right bellow the root project folder, for building classpath from source files ?

Putting entire project as a source folder is nonsense.
Putting separate folders as source folders can't be done if they are part of the package hierarchy and the only thing I could think of, is to copy the source folders into a separate folder and add it then as source folder which is weird but I don't know how else to do it.
Having to duplicate sources just because of the eclipse way of making classpath and also because of somebody doing stupid project structure

It's really pain in the ass...because the ant scripts are written for this structure.
Even if it was just one folder, it's a problem anyway. There must be included the upper folder to the source classpath which means it is included with all the crap around and also it means that package explorer is flooded with the packages.

example:
Instead of /project/src/java/utils where we can put src folder into source classpath...
there is project/java/utils + lot of crap like /project/docs is in the project as well.

+1  A: 

The trick is:

An Eclipse project root directory is defined by where the .project and .classpath are.

Two options here:

  1. Those Eclipse project files are located in the workspace (and the 'project', the one with 'java/utils' inside, is not)
    Then you can make a linked folder within the Eclipse project to reference 'project', calling that linked folder as 'src', using it as your source folder.
    alt text
    The ant script remains right where it originally is (in the 'project' directory, along with all the other sub-directories)

  2. Those Eclipse project files are located directly within the 'project' directory (along with 'java' and 'docs': don't.
    Delete that Eclipse project (not its content, only its definition, that will only remove the .eclipse and the .classpath), and recreate anywhere else.
    Then go back to 1.

VonC
A: 

For each source folder in eclipse you can choose which subfolders of it you want to include or exclude as a source folder (you can also use patterns). If I understand correctly, in your situation you can add the project root folder as a source folder and include only those folders that contain source. So in your example only "java" would be included.

Piotr
If you did this, the project would be "flooded" with the package folders representing package hierarchy which would be otherwise in project/src for instance.
lisak