IAmYourFaja
IAmYourFaja

Reputation: 56874

Eclipse and Package Explorer

I want to set up a new Eclipse project with a directory structure as follows:

Myproject/
    src/
        config/
        java/
    test/
        config/
        java/
    lib

Where src/ and test/ are both "source" folders (they contain either .xml or .java files). Obviously, src/config/ contains all the XML config files for my primary Java source files (which get packaged under src/java/).

What I'd like to achieve (if possible) would be to just see the following in Package Explorer:

MyProject
    src/config
    src/java
    test/config
    test/java
    lib

But instead, after adding all fource "source" folders to the project, I see this:

MyProject
    src
    src/config
    src/java
    test
    test/config
    test/java
    lib

This is most annoying!! When I go into Project Properties >> Java Build Path >> Source I see the same folders listed as source folders as directly above:

MyProject/src
MyProject/src/config
MyProject/src/java
MyProject/test
MyProject/test/config
MyProject/test/java

Is there any way to force Package Explorer to present my 4 source folders and not even list the src/ and test/ folders? It just seems bulky, unnecessary and annoying, since I'll never be adding anything to them directly. Everything will be added to their config/ and java/ subdirectories.

Upvotes: 1

Views: 955

Answers (3)

bithead61
bithead61

Reputation: 196

Use the Navigator view instead of the Package view. It provides a hierarchical view of your project instead of showing every package at the same level.

Upvotes: 1

JB Nizet
JB Nizet

Reputation: 691635

src and test should not be source folders. src/java, src/config, test/java, test/config should be source folders. Source folders should contain the root of the package tree. And java and config are not packages.

Upvotes: 3

Tobias
Tobias

Reputation: 9380

I would only set src/ and test/ as source folders. You can put packages / folders there for structure.

Upvotes: 1

Related Questions