Why do maven projects have an src folder in which there are two empty subfolders (main and test)

I am new to java world. I created a simple java (maven) project and I see packages and everything works fine. However, I see src with two empty main and test folders. Any idea why?

enter image description here

EDIT: Adding More Information to the Answer The answer below is ideal. However, having worked a little more, I found a more compelling reason why this is shown in the eclipse.

If the folder is in the "Java build path", these folders will be shown above in a specialized view. Thus, you can create any folder, and as soon as you add this folder to the "Java build path", the appearance of this folder will change. The same thing, if you delete an existing folder from the "Java build path", then it seems to be returned as a regular tree view below.

+8
java maven
source share
2 answers

Folder is not empty. See where your App.java is located: src/main/java/com/nuance/spring

Eclipse hides your content on this place, because these are special folders with a special look above.

If you have other folders that are not special, such as WEB-INF, you will see them there.

+4
source share

they are not really empty if you look at the directory from the side of your editor (looks like eclipse). eclipse has created the source folders for you, which can be seen above. src / main / java and src / test / java.

therefore, if you look at the folder in your operating system browser, you should see the files there

+2
source share

All Articles