Eclipse + Maven src / main / java在包资源管理器的src文件夹中不可见 [英] Eclipse+Maven src/main/java not visible in src folder in Package Explorer
问题描述
我想知道为什么我在Package Explorer中看不到src节点中的以下文件夹
src / main / java
src / main / resources
src / test / java
src / test / resources
我可以访问这些文件夹作为项目的直接子项,它们存在于文件系统中。
我使用的是Spring Tool Suite(STS of eclipse
可能我可以配置Eclipse吗?
Eclipse将从raw文件夹路径中标记为源的文件夹过滤出来。也就是说,它们仅作为源文件夹可见:
如果您无法在任何位置看到它们,那么他们
- 在设置中被过滤掉:检查您的设置为Package Explorer(Package Explorer栏,向下菜单箭头 - > Filters ... )
- 或者它们不存在:右键单击在项目中,选择 New-> Folder 并输入路径,例如
src / test / java
(不源文件夹)。在项目中使用Maven->更新项目...之后,如果您有默认配置,它们将被自动添加为源文件夹。
<或者它们是在外部创建的,Eclipse没有注意到他们:刷新您的项目。
现在,正如我所说,如果您在 POM
中保留默认配置,那么这些文件夹将仅作为源使用。如果您定义了其他资源
和/或 testResources
,那么将使用它们。通常,Eclipse m2e将Eclipse的项目源文件夹配置与您的 POM
中的内容进行同步。
编辑: 可能这还不清楚 - 看到顶部的那些文件夹?标有/ -separated路径的那些?这些是你的文件夹。这些是您希望在 main
和 test
中找到的文件夹相同的文件夹,只是 em>。
I'm wondering why I can't see following folders in src node in Package Explorer
src/main/java
src/main/resources
src/test/java
src/test/resources
I can access those folders as direct children of the project and they exist in the file system.
I'm using Spring Tool Suite (STS of Eclipse).
Maybe I can configure Eclipse somehow ?
Eclipse filters out folders that are marked as source from the "raw" folder path. That is, they are visible only as source folders:
If you can't see them in either place, then they
- are either filtered out in the settings: check your settings for Package Explorer (the Package Explorer bar, downwards menu arrow -> Filters...)
- or they were created externally and Eclipse haven't noticed them: Refresh your project in this case.
- or they don't exist: right-click on the project, select New->Folder and input the path, e.g.
src/test/java
(not "Source Folder"). After you use Maven->Update Project... on the project, they will be automatically added as source folders, provided you have the default configuration.
Now, as I said, those folder will only be used as source if you preserved the default configuration in your POM
. If you defined other resources
and/or testResources
, those will be used instead. In general, Eclipse m2e synchronizes Eclipse's project source folder configuration with what's in your POM
.
EDIT: maybe this is unclear - see those folders at the top? The ones labeled with the /-separated paths? These are your folders. These are the same folders that you would expect to find in main
and test
, just represented differently.
这篇关于Eclipse + Maven src / main / java在包资源管理器的src文件夹中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!