The default source folder for a Java Maven project is src/main/java. In the project on the right, the source folder is set to src via the following line in the pom.xml file:

<sourceDirectory>src</sourceDirectory>

If you remove the line or change the value, right-click the project and choose Maven > Update Project... to have Eclipse read the pom.xml file and update the source folder location accordingly.

Answer from howlger on Stack Overflow
🌐
Apache Maven
maven.apache.org › guides › introduction › introduction-to-the-standard-directory-layout.html
Introduction to the Standard Directory Layout - Apache Maven
The src directory contains all of the source material for building the project, its site and so on. It contains a subdirectory for each type: main for the main build artifact, test for the unit test code and resources, site and so on. Within artifact producing source directories (ie. main and ...
🌐
Baeldung
baeldung.com › home › maven › apache maven standard directory layout
Apache Maven Standard Directory Layout | Baeldung
January 8, 2024 - ... src/main/resources – configuration files and others such as i18n files, per-environment configuration files, and XML configurations · src/main/webapp – for web applications, contains resources like JavaScript, CSS, HTML files, view ...
Discussions

How strictly should I follow the standard Maven project structure?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full - best also formatted as code block You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnjava
7
3
July 16, 2023
java - Location of generated source files for maven directory structure - Stack Overflow
The source code is generated manually ... generated/src/test/java/, generated/src/main/resources/ and so on. This code should be checked in. A benefit is, as soon you see that the top-level directory name is generated you know that all files/directories below are also generated. Also you have the standard maven directory structure under the ... More on stackoverflow.com
🌐 stackoverflow.com
Difference between src/main/java and src/test/java in a Maven project - Stack Overflow
While creating a new Maven project, the directories src/main/java and src/test/java are created. With some googling, I came to know that my main source code that I use for testing must be placed in src/main/java. But then, what is the purpose of two separate directories. More on stackoverflow.com
🌐 stackoverflow.com
How to edit the directory structure in Maven? - Stack Overflow
I am using Maven project, when ... maven auto generates directory structue as src/main/java, src/main/resources, src/test/java and src/test/resources. Can I edit the above names as per my wish? Can I add new folders to the same parent? Also when i googled, I came to know abt super POM, can anybody suggest how to edit the same with the custom directory structure... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Jenkov
jenkov.com › tutorials › maven › directory-structure.html
Maven Directory Structure
The standard Maven directory structure looks like this: myprojectdir - pom.xml - .mvn - jvm.config - src - main - java - resources - test - java - resources - target
🌐
Medium
medium.com › @pvprasanth474 › understanding-the-maven-directory-structure-a-simple-guide-7c7d636ec614
Understanding the Maven Directory Structure: A Simple Guide | by PV Prasanth | Medium
January 9, 2025 - In a Maven project, this is where your Java code lives — this is the core of your application. Imagine you’re building a toy robot. All the main parts of the robot like the code that tells the robot to move, talk, or do specific tasks — go into this room. Similarly, in the src/main/java folder, you write the code that defines the behavior of your application.
🌐
Reddit
reddit.com › r/learnjava › how strictly should i follow the standard maven project structure?
r/learnjava on Reddit: How strictly should I follow the standard Maven project structure?
July 16, 2023 -

Hi

I am learning Maven from the official docs. I see that it wants a src/main/java/com/mycompany/appname directory structure. So I did some googling on java packages and I see why these are useful. But my question is, is the java/com/ really necessary?

I really don't like all these nested folders. How about something like src/main/mycompany/appname? It's still a package right? However I am only a java novice so if there is a good reason for structuring it like this, I'd like to know.

🌐
Java2s
java2s.com › Tutorials › Java › Maven_Tutorial › 1030__Maven_Directory_Structure.htm
Maven Tutorial - Maven Directory Structure
The src directory is the root directory of source code and test code. The main directory is the root directory for source code related to the application itself, not test code. The test directory contains the test source code. The java directories under main and test contains the Java code ...
Find elsewhere
🌐
Apache Maven
maven.apache.org › guides › mini › guide-using-one-source-directory.html
Using Maven When You Can't Use the Conventions – Maven
that demonstrates how this is normally done in Maven, as it is quite similar. Your directory will look something like this: / +- pom.xml +- src/ +- main/ +- java/ +- core/ +- Core.java +- module/ +- Module.java ·
🌐
Streambase
docs.streambase.com › latest › topic › com.streambase.sb.ide.help › data › html › authoring › maven-whatgoeswhere.html
What Goes Where in Project Folders
You can organize your Java files into different packages using New>Package from the packagename folder's context menu. ... The following file types belong in the src/main/resources folder. Files in this folder are automatically on the Maven resource search path.
🌐
Red Hat
access.redhat.com › documentation › en-us › red_hat_jboss_fuse › 7.0-tp › html › deploying_into_apache_karaf › build-mavendir
Chapter 35. Maven Directory Structure | Deploying into Apache Karaf | Red Hat JBoss Fuse | 7.0-TP | Red Hat Documentation
If you have any configuration files, data files, or Java properties to include in the bundle, these should be placed under the src/main/resources/ directory. The files and directories under src/main/resources/ will be copied into the root of the JAR file that is generated by the Maven build process.
🌐
O'Reilly
oreilly.com › library › view › java-ee-8 › 9781788833776 › 43a61672-4663-4de6-b336-a36a3c5a045e.xhtml
Maven project structure - Java EE 8 Development with Eclipse - Third Edition [Book]
June 29, 2018 - The Java package structure starts from the java folder, that is, src/main/java/<java-packages>. Web content such as HTML, JS, CSS, and JSP goes in the webapp folder under src/main.
Author   Ram Kulkarni
Published   2018
Pages   596
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_jboss_fuse › 6.3 › html › deploying_into_apache_karaf › build
Chapter 3. Building with Maven | Deploying into Apache Karaf | Red Hat JBoss Fuse | 6.3 | Red Hat Documentation
If you have any configuration files, data files, or Java properties to include in the bundle, these should be placed under the src/main/resources/ directory. The files and directories under src/main/resources/ will be copied into the root of the JAR file that is generated by the Maven build process.
🌐
YouTube
youtube.com › watch
MAVEN Directories - src/main/java and src/test/java - Whiteboard Learning - YouTube
In this video, I have explained about different maven directories.Learn:what is src/main/java and src/test/javawhat is src/main/resources and src/test/resour...
Published   August 28, 2020
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_jboss_fuse › 6.0 › html › deploying_into_the_container › build
Chapter 3. Building with Maven | Deploying into the Container | Red Hat JBoss Fuse | 6.0 | Red Hat Documentation
If you have any configuration files, data files, or Java properties to include in the bundle, these should be placed under the src/main/resources/ directory. The files and directories under src/main/resources/ will be copied into the root of the JAR file that is generated by the Maven build process.
🌐
Xenovation
xenovation.com › home › blog › java › maven directory structure
Maven directory structure | XENOVATION
September 8, 2019 - This bash script helps you to create the needed maven folder structure in your project. mkdir -p src/main/java mkdir -p src/main/javascript mkdir -p src/main/resources mkdir -p src/main/filters mkdir -p src/main/assembly mkdir -p src/main/config ...
🌐
Codetab
codetab.org › tutorial › apache-maven › plugins › manage-maven-directories
Manage Directories - Apache Maven Tutorial – CodeTab
January 11, 2019 - outputDirectory - directory to ... and it points to target/test-classes. sourceDirectory - project source code files folder and it points to src/main/java in project base dir....