简体   繁体   中英

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.

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM