Maven Creating Project - Maven

How to create a project with Maven?

Archetype plugins are used by Maven to create projects. Use maven-archetype-quickstart plugin to create a simple java application. Let’s create a maven based java application project in C:\MVN folder.
Now open the command console, go to the C:\MVN directory and execute the following mvn command.
Maven will start processing and will create the complete java application project structure.
Now go to C:/MVN directory. You'll see a java application project created, named consumer Banking (as specified in artifactId). Maven uses a standard directory layout as shown below −
project_structure
Using the above example, we can understand the following key concepts −
Sr.No. Folder Structure & Description
1

consumerBanking

contains src folder and pom.xml

2

src/main/java

contains java code files under the package structure (com/companyName/bank).

3

src/main/test

contains test java code files under the package structure (com/companyName/bank).

4

src/main/resources

it contains images/properties files (In above example, we need to create this structure manually)

If you observe, you will find that Maven also created a sample Java Source file and Java Test file. Open C:\MVN\consumerBanking\src\main\java\com\companyname\bank folder, you will see App.java.
Open C:\MVN\consumerBanking\src\test\java\com\companyname\bank folder to see AppTest.java.
Developers can store their files as mentioned in table above and Maven handles all the build related complexities.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Maven Topics