Reputation: 96491
When i create a new Maven project in Eclipse, directory structure contains both src/main/java
and src/main
(down below)
Question:
I understand my code should fall under src/main/java
, what is the purpose of the src/main
? Why does Eclipse create it?
Upvotes: 9
Views: 13065
Reputation: 4999
You can have other sub-directories under src/main that are not source files. If you see Maven documentation you need to have resource files under src/main/resources. Obviously the parent directory src/main needs to be created to create child directories.
Upvotes: 3
Reputation: 16799
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/
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.
Look for the down arrow in the top right of the package explorer view for the filters option.
Upvotes: 7
Reputation: 23443
src/main/java
is Maven's standard layout for placement of your Java source codes.
Check http://java.sg/maven-standard-directory-layout/ for a list of standard Maven directories.
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
Upvotes: 10