[英]Java Project vs Maven Project (Eclipse), dir structure clarification needed
When i create a new Maven project in Eclipse, directory structure contains both src/main/java
and src/main
(down below) 当我在Eclipse中创建一个新的Maven项目时,目录结构包含src/main/java
和src/main
(下面是)
Question: I understand my code should fall under src/main/java
, what is the purpose of the src/main
? 问:我的理解我的代码应该落在下src/main/java
,有什么目的src/main
? Why does Eclipse create it? 为什么Eclipse会创建它?
src/main/java
is Maven's standard layout for placement of your Java source codes. src/main/java
是Maven用于放置Java源代码的标准布局。
Check http://java.sg/maven-standard-directory-layout/ for a list of standard Maven directories. 检查http://java.sg/maven-standard-directory-layout/以获取标准Maven目录的列表。
src/main/java Application/Library sources
src/main/resources Application/Library resources
src/main/filters Resource filter files
src/main/assembly Assembly descriptors
src/main/config Configuration files
src/main/webapp Web application sources
src/test/java Test sources
src/test/resources Test resources
src/test/filters Test resource filter files
src/site Site
LICENSE.txt Project's license
NOTICE.txt Notices and attributions required by libraries that the project depends on
README.txt Project's readme
For src/main/java to exist src/main/ must first exist so eclipse just shows you all the folders in your project including src/main/ 对于src / main / java存在src / main /必须首先存在,所以eclipse只显示项目中的所有文件夹,包括src / main /
If you want to remove them from your view in package explorer, you can create a filter for the package explorer view and exclude Non-Java elements . 如果要从包浏览器中的视图中删除它们,可以为包浏览器视图创建过滤器并排除非Java元素 。
Look for the down arrow in the top right of the package explorer view for the filters option. 在包浏览器视图的右上角查找过滤器选项的向下箭头。
You can have other sub-directories under src/main that are not source files. 您可以在src / main下拥有不是源文件的其他子目录。 If you see Maven documentation you need to have resource files under src/main/resources. 如果您看到Maven文档,则需要在src / main / resources下拥有资源文件。 Obviously the parent directory src/main needs to be created to create child directories. 显然,需要创建父目录src / main来创建子目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.