top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Maven: A Friendly Helper

What is Maven?

Maven is a project management tool and is used for build management and dependencies management. During build, the project or source code is converted into JAR files.


Problems Solved by Maven

When building any JAVA project, additional JAR files are needed (e.g., Spring, Hibernate, etc.). One approach to do so is to download the JAR files from each project website and then manually add the JAR files to the build path/class path. This is a tedious process and can cause error during the process of download and addition to the build path.

Maven is the friendly helper and the solution for the previously described problems. Just tell the Maven about the projects you are working with (e.g., Spring, Hibernate, etc.) and Maven will go out and download all the JAR files needed for those projects. Maven will make those files available during the compile or run time.


How Maven Works?


Maven working process can be easily understood by below flow diagram:




The above diagram can be easily understood by using the below points:

1. Maven read the config file given by developer/tester.

2. Maven checks the Maven Local Repository.

3. If files are not present in the Maven Local Repository, then Maven will go out to the internet at Maven Central Repository and pull those files from the Central Repository and

4. Save those JAR files to the Local Repository to build up the local and then

5. Maven will use those JARS to build and run the application.


Standard Directory Structure provided by Maven and their Benefits


Few benefits of using Maven are:

1. For any new developers/Testers joining a project, they can easily find the code, properties, files, unit tests, etc. by looking at the Standard Directory Structure.

2. Most major IDEs (e.g., Eclipse, IntelliJ, NetBeans etc.) have built in support for Maven. So, IDEs can easily read and import Maven projects.



pom.xml

pom.xml stands for Project Object Model file. It is located in the root of Maven project. pom.xml can be divided into three parts. First, Project meta data where project name, version etc. are present. Second, Dependencies which has the list of projects we depend on and third, plug-ins which is required for additional custom tasks to run.


Project coordinates are used to uniquely identify a project. It has three main elements (GAV):

1. Group ID: Name of the company or Organization which is used in reverse domain name (e.g., com.numpyninja)

2. Artifact ID: Name of the project

3. Version: A specific release version like 1.0. If the project is under active development, then it is written as 1.0-SNAPSHOT else 1.0 FINAL.


Please see the below screenshot for more understanding

Project Name GAV

Dependencies


61 views0 comments

Recent Posts

See All
bottom of page