英文:
Eclipse doesn't show src/main/resources in my maven project the way I see it elsewhere
问题
我正在处理一个别人创建的 Maven 项目。在 Eclipse 的包资源管理器中,它的结构如下所示:
他们的项目名称
src/main/java
src/main/resources
src/test/java
src/test/resources
JRE 系统库
Maven 依赖项
...
src
main
test
pom.xml
他们的项目名称.launch
我也在从头开始创建的一个 Maven 项目中工作。它的结构如下所示:
我的项目名称
src/main/java
src/test/java
JRE 系统库
Maven 依赖项
src
main
resources
...
pom.xml
换句话说,当我尝试创建 src/main/resources
目录时,它没有出现在我想要的位置,而是出现在了 src
文件夹中,而不是顶层显示。我是否错过了什么步骤?如果我从操作系统资源管理器查看工作区,我们的目录结构是相同的。
英文:
I am working on a maven project someone else created. The package explorer in eclipse looks like
their_project_name
src/main/java
src/main/resources
src/test/java
src/test/resources
JRE System Library
Maven Dependencies
...
src
main
test
pom.xml
their_project_name.launch
I'm also working on a Maven project I started from scratch. Its structure looks like:
my_project_name
src/main/java
src/test/java
JRE System Library
Maven Dependencies
src
main
resources
...
pom.xml
In other words, when I tried to create the src/main/resources directory, it didn't show up in the explorer where I wanted it to go. It instead went in this src folder, instead of showing up at the top level. Is there a step I missed? If I look at the workspace from my OS explorer, our directory structures are the same.
答案1
得分: 2
你创建了一个 Folder
还是一个 Source Folder
?正确的是 Source Folder
,并且使用正确的名称,它应该显示在 src/main/java
旁边。
英文:
Did you create a Folder
or a Source Folder
? The correct one is Source Folder
, and with the correct name, it should show up next to the src/main/java
.
答案2
得分: 1
解决方案
您需要将资源文件夹添加到类路径中。请按照以下步骤进行操作:
- 右键单击文件夹
- 将鼠标悬停在 Build Path 上
- 单击 Use as Source Folder
> 那些顶级目录是源文件夹的“快捷方式”
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论