简体   繁体   English

Eclipse和软件包浏览器

[英]Eclipse and Package Explorer

I want to set up a new Eclipse project with a directory structure as follows: 我想用目录结构设置一个新的Eclipse项目,如下所示:

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

Where src/ and test/ are both "source" folders (they contain either .xml or .java files). 其中src/test/都是“源”文件夹(它们包含.xml或.java文件)。 Obviously, src/config/ contains all the XML config files for my primary Java source files (which get packaged under src/java/ ). 显然, src/config/包含了我的主要Java源文件的所有XML配置文件(这些文件打包在src/java/ )。

What I'd like to achieve (if possible) would be to just see the following in Package Explorer: 我想要实现的(如果可能的话)将是在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: 但是,相反,在将所有Fource“源”文件夹添加到项目中之后,我看到了:

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: 当我进入“项目属性” >>“ Java构建路径”>“源”时,我看到的文件夹与上面列出的文件夹相同:

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? 有什么方法可以强制 Package Explorer显示我的4个源文件夹,甚至列出src/test/文件夹? 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. 一切都将添加到它们的config/java/子目录中。

src and test should not be source folders. srctest不应是源文件夹。 src/java , src/config , test/java , test/config should be source folders. src/javasrc/configtest/javatest/config应该是源文件夹。 Source folders should contain the root of the package tree. 源文件夹应包含软件包树的根。 And java and config are not packages. Java和config不是软件包。

I would only set src/ and test/ as source folders. 我只会将src /和test /设置为源文件夹。 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. 它提供了项目的分层视图,而不是在同一级别显示每个包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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