简体   繁体   English

Eclipse在src文件夹中不显示Java文件夹(渐变)

[英]Eclipse does not show java folder in src folder (gradle)

I've cloned gradle project from github and imported it into IDE Spring Tool Suite (eclipse). 我已经从github克隆了gradle项目,并将其导入到IDE Spring Tool Suite(Eclipse)中。 You see that project calls projectWithGitIgnoreGradle the first item in structure is src/main/java which has default package 您会看到项目调用projectWithGitIgnoreGradle,结构中的第一项是src / main / java,它具有默认包

在此处输入图片说明

I'm not sure that this is good way, but I created my classes and packages in another project in this src folder: 我不确定这是否是好方法,但是我在此src文件夹的另一个项目中创建了类和包:

在此处输入图片说明

but in my case (as you saw in first image) structure in the first src folder has java folder. 但就我而言(如您在第一张图片中所见),第一个src文件夹中的结构具有java文件夹。 but in second src folder (image 2) it is empty. 但在第二个src文件夹(图像2)中为空。 And even if I try to create a package or class in second src folder, it doesn't appear in this src folder (but appear in first one). 即使我尝试在第二个src文件夹中创建一个包或类,它也不会出现在该src文件夹中(而是出现在第一个文件夹中)。

在此处输入图片说明

Why is this happening and how can I fix this? 为什么会发生这种情况,我该如何解决? Why classes I create doesn't appear in second src folder? 为什么我创建的类没有出现在第二个src文件夹中? Why here is two different src items in the project? 为什么在项目中有两个不同的src项?

The first src folder ie src/main/java consists of all java files whereas, the second src folder can contain html, jsp type files and resources such as Images. 第一个src文件夹即src/main/java包含所有Java文件,而第二个src文件夹可以包含h​​tml,jsp类型的文件和资源(例如图像)。 Do have a look on the following image where the first src folder consists of java files and the second one consists of all the view or web files like html, jsp files as well as image folder which consists of images used for your project. 请看下面的图像,其中第一个src文件夹包含java文件,第二个s包含所有视图或Web文件,例如html,jsp文件以及包含用于项目的图像的图像文件夹。

在此处输入图片说明

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

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