<div dir="ltr" style="text-align: justify;">
<div dir="ltr" style="text-align: justify;">
<div style="text-align: justify;">In last tutorial we learnt to <a href="https://dineshonjava.com/2015/06/how-to-configure-maven-in-eclipse.html" target="_blank" rel="noopener"><b>configure maven in eclipse</b></a> . In this tutorial we will learn to create new maven project in eclipse.</div>
<div style="text-align: justify;"></div>
<div style="text-align: justify;"><b>To create a new project in maven we need to follow following steps </b></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b>1) Open eclipse and follow stated navigation represented in below pic</b></div>
<div class="separator" style="clear: both; text-align: justify;"><img src="https://dineshonjava.com/wp-content/uploads/2015/06/maven_new_1.png" width="320" height="158" border="0" /></div>
<div style="text-align: justify;"><b>2) A new pop- up will open , in that pop-up we need to check the provided option as below</b></div>
<div style="text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><img src="https://dineshonjava.com/wp-content/uploads/2015/06/maven_new.png" width="400" height="247" border="0" /></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b>3) Again a new pop-up will open, in that pop-up box we need to fill some information related to our project.</b></div>
<div style="text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><img src="https://dineshonjava.com/wp-content/uploads/2015/06/maven_new_2.png" border="0" /></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b>After filling required fields click finish button.</b></div>
<div style="text-align: justify;"><b> </b></div>
<div style="text-align: justify;"><b>4) After clicking finish button you will find a new project being created in the project explorer.</b></div>
<div style="text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><img src="https://dineshonjava.com/wp-content/uploads/2015/06/maven_new_3.png" width="400" height="288" border="0" /></div>
<div style="text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>5) You can see a new project has been created with symbol &#8216;M&#8217; over the project which shows that it is maven project. </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>6) You can see maven has provided the specified folder structure and a POM.xml file by his own. This is why maven is called as &#8220;Convention Over Configuration&#8221;.</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>7) POM.xml is heart of maven project.</b></div>
<p> ;</p>
<div style="text-align: justify;">
<pre class="highlight"><;project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">;<;modelversion>;4.0.0<;/modelversion>; 
 
<;groupid>;com.dineshonjava.example<;/groupid>; 
 
<;artifactid>;maven_first_example<;/artifactid>; 
 
<;version>;0.0.1-SNAPSHOT<;/version>; 
 
<;name>;sample project<;/name>; 
 
<;description>;this project is being created for learning.<;/description>; 
<;/project>;</pre>
</div>
<p> ;</p>
<div class="separator" style="clear: both; text-align: justify;"><b>8) The content of this pom.xml is being generated based on the information we have filled while creating the new project using maven.</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>9) By following Convention over configuration maven states that &#8221; I am providing specific folder structure to put specific files, like : </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> src/main/java &#8211;>; to put .java file</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> src/main/resources &#8211;>; to put resource files like properties file in class path</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> src/test/java &#8212;>; to put . java file for junit test cases.</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>10) Now we will be writing simple Java program in src/main/java</b></div>
<div style="text-align: justify;">
<pre class="highlight">package com.dineshonjava; 
public class Example1 { 
public static void main(String[] args) { 
System.out.println("welcome to maven"); 
 
 } 
}</pre>
</div>
<p><b>11) Now we need to run the application, Before running the application we need to build that and to build that </b><br />
<b> a) right click on the project </b><br />
<b> b) click on the run as &#8216;maven install&#8217; </b><br />
<b> c) after clicking that look into console , if every thing will be fine you will find following :</b><br />
<b> </b></p>
<div class="separator" style="clear: both; text-align: justify;"></div>
<pre class="highlight">[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ maven_first_example --- 
[INFO] Building jar: E:newsprinwsmaven_first_exampletargetmaven_first_example-0.0.1-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ maven_first_example --- 
[INFO] Installing E:newsprinwsmaven_first_exampletargetmaven_first_example-0.0.1-SNAPSHOT.jar to C:Userslenovo.m2repositorycomdineshonjavaexamplemaven_first_example.0.1-SNAPSHOTmaven_first_example-0.0.1-SNAPSHOT.jar 
[INFO] Installing E:newsprinwsmaven_first_examplepom.xml to C:Userslenovo.m2repositorycomdineshonjavaexamplemaven_first_example.0.1-SNAPSHOTmaven_first_example-0.0.1-SNAPSHOT.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.271s 
[INFO] Finished at: Tue Jun 16 23:35:35 IST 2015 
[INFO] Final Memory: 7M/178M 
[INFO] ------------------------------------------------------------------------ 
</pre>
<div class="separator" style="clear: both; text-align: justify;"></div>
<div class="separator" style="clear: both; text-align: justify;"><b>12) After running that process , when you will look into project explorer you will find following </b></div>
<div class="separator" style="clear: both; text-align: center;"></div>
<p> ;</p>
<div class="separator" style="clear: both; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2015/06/maven_new_4.png" border="0" /></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>13) Due to above process which ease the building of project , maven is also famous as automated building tool.</b></div>
<div class="separator" style="clear: both; text-align: justify;"><b> </b></div>
<div class="separator" style="clear: both; text-align: justify;"><b>14) Now to run this simple application just click on the project and run as a java application and you can find the desired output in console.</b></div>
<div class="separator" style="clear: both; text-align: justify;"></div>
<div class="separator" style="clear: both; text-align: justify;"><b>More we will learn about the different components of maven in upcoming tutorial .</b></div>
<div class="separator" style="clear: both; text-align: justify;"></div>
<div class="separator" style="clear: both; text-align: justify;"><b>Keep Learning, Happy Coding</b></div>
</div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/how-to-install-maven-in-windows/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/how-to-configure-maven-in-eclipse/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '160'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…