Categories: Maven

Maven Directory Structure

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;"><b>Maven Directory Structure<&sol;b><br &sol;>&NewLine;Maven has own standard for directory structure to create in a project&period; So we no need specify any directory on the project level for sources&comma; resources&comma; tests&comma; plugins etc&period; And also we don&&num;8217&semi;t need to configure for creating directory structure on the pom&period;xml file it is internal functionality of maven&period;<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2016&sol;10&sol;Maven-dirctory-structure&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<p><i><b>&commat;ImageSource-Wikipedia&period;com<&sol;b><&sol;i><&sol;p>&NewLine;<p>&&num;8211&semi; src<br &sol;>&NewLine;&&num;8211&semi; main<br &sol;>&NewLine;&&num;8211&semi; java<br &sol;>&NewLine;&&num;8211&semi; resources<br &sol;>&NewLine;&&num;8211&semi; webapp<br &sol;>&NewLine;&&num;8211&semi; test<br &sol;>&NewLine;&&num;8211&semi; java<br &sol;>&NewLine;&&num;8211&semi; resources<&sol;p>&NewLine;<p>&&num;8211&semi; target<&sol;p>&NewLine;<&sol;div>&NewLine;<h2><b>Directories level on project created by Maven<&sol;b><br &sol;>&NewLine;<b><&sol;b><&sol;h2>&NewLine;<h3><b>Source Directory<&sol;b><br &sol;>&NewLine;<b><&sol;b><&sol;h3>&NewLine;<p><b>-src <&sol;b>This is src directory which contains two more such as <b>main <&sol;b>and <b>test <&sol;b>directories inside&period; The main directory is for your source code and test directory is for test code&period;<&sol;p>&NewLine;<p><b>-main <&sol;b>Under the main directory there are many more directories such as <b>java<&sol;b>&comma; <b>resources<&sol;b>&comma; <b>webapps <&sol;b>etc&period;<&sol;p>&NewLine;<p><b>-java<&sol;b> The <b>java <&sol;b>directory contains all java codes and packages<&sol;p>&NewLine;<p><b>-resources <&sol;b>The <b>resources <&sol;b>directory contains other resources needed by your project&period; This could be property files used for internationalization of an application&comma; or something else&period;<&sol;p>&NewLine;<p><b>-webapp<&sol;b> The <b>webapp <&sol;b>directory contains your Java web application&comma; if your project is a web application&period;<&sol;p>&NewLine;<p><b>-test <&sol;b> Under test directory contains two directories such as <b>java <&sol;b>and <b>resources<&sol;b>&period;<&sol;p>&NewLine;<h3><b>Target Directory<&sol;b><br &sol;>&NewLine;<b><&sol;b><&sol;h3>&NewLine;<p><b>-target<&sol;b> The target directory is created by Maven&period; It contains all the compiled classes&comma; JAR files etc&period; produced by Maven&period; When executing the clean build phase&comma; it is the target directory which is cleaned&period;<&sol;p>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;maven-pom-xml-file&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;maven-settings-file&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '105'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design Patterns using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago