为什么maven项目有一个src文件夹,里面有两个空的子文件夹(main和test) [英] Why do maven projects have a src folder which has two empty sub-folders (main and test)

查看:847
本文介绍了为什么maven项目有一个src文件夹,里面有两个空的子文件夹(main和test)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是java世界的新手。我创建了一个简单的java(maven)项目,我看到了包,一切都很完美。但是我确实看到一个带有两个空的main和test文件夹的src。知道为什么吗?

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

编辑:在答案中添加更多信息
以下答案是完美的。然而,在修补一点点之后,我发现了一个更令人信服的理由,为什么它在eclipse中显示出来。

Adding more information to the answer The answer below is perfect. However on tinkering a little more I found a more compelling reason why it is shown like that in eclipse.

如果文件夹在Java构建路径中,那么这些文件夹将在专业视图中显示如上。因此,您可以创建任何文件夹,一旦将该文件夹添加到Java构建路径,该文件夹的视图就会更改。如果您从Java构建路径中删除现有文件夹,那么它似乎会返回到底部的普通树视图。

If the folder is in "Java build path" then those folders will be shown above in the specialized view. So you can create any folder and once you add that folder to the "Java build path" the view for that folder changes. Same if you remove an existing folder from the "Java build path" then it seems to go back as a normal tree view in the bottom.

推荐答案

文件夹不为空。看看你的App.java在哪里: src / main / java / com / nuance / spring

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

Eclipse隐藏你这个地方的内容,因为这是上面有特​​殊视图的特殊文件夹。

Eclipse hide you content on this place because that are special folders with special view above.

如果您有其他特殊文件夹,例如WEB-INF,那么您会看到它在那里。

If you have other folders that aren't special, for example WEB-INF then you'll see it there.

这篇关于为什么maven项目有一个src文件夹,里面有两个空的子文件夹(main和test)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆