Software DevelopmentLearn How To Install And Set Up The Maven Environment

Learn How To Install And Set Up The Maven Environment

Before we can start this tutorial on the Apache Maven tool, the prerequisite is that you have work experience on building Java enterprise development projects based on Java SE, J2EE, etc. Apache Maven can be defined as a software project management tool which is based on the concept of POM (Project Object Model). It helps developers prepare the project’s build and manages documentation as well as reporting from the available project information. Apache Maven is capable of providing a complete build lifecycle framework to the developers. The software development team can automate the entire project’s build infrastructure with the help of this tool as it uses a default build lifecycle and a standard directory layout.

Apache Maven Overview
Apache Maven as a comprehensive project building tool can help set-up the work environment as per standards in a very short time, where the project has multiple development team environment. It ends up in providing simple and reusable project setups. The use of Apache Maven tool in a project makes the day to day work of developers easy and simple during the reports creation, checks, build and other testing automation setups. It can provide the following ways to manage stuffs for the developers in a project.
• Builds
• Documentation
• Reporting
• Dependencies
• SCMs
• Releases
• Distribution
• Automated mailing list
Apache Maven helps standardize the overall project level build procedure. It is capable of handling the project’s build compilation, distribution, documentation, team collaboration and other numerous project level tasks. It encourages reusability and simplifies the procedure related to the build related tasks.

History of Apache Maven
Maven tool was developed by the Apache group to accomplish the following project tasks.
• To build multiple projects together.
• To publish the project level information.
• To deploy the projects build.
• To share JARs, EARs and WARs across several projects.
• To help in the teams collaboration.

Objective of Apache Maven
Apache Maven has the following objectives.
• To provide the developers with a comprehensive model for projects which is reusable, easy to maintain with successive project releases, and easier to understand.
• To provide plugins or tools which can interact with this declarative model.
Maven tool obeys the POM (Project Object Model) where the project structure and contents are defined and declared in an xml file known as pom.xml. It is known as the fundamental unit of the entire Maven project system.

Apache Maven Conventions
Apache Maven has a build structure that uses Convention over Configuration. Therefore, the developers are not required to put down every configuration detail in order to build a project through Maven. Apache Maven has a default behavior for the projects. When we choose a Maven project (say through eclipse), then Maven generates a default project structure and developer are required to use this structure in order to place the project files accordingly without defining any configuration details in the pom.xml. The following is an example on the Maven configuration which shows the default values for source code files, resource files and other project level configuration details. Let us assume that ${basedir} represents the project location.

S No.




Source code









Distributable JAR



Complied byte code


File structure for Maven project as visible in eclipse
File structure for Maven project
Steps to set up Apache Maven Environment
Apache Maven is a tool which is built on the Java Platform. Therefore, it is a prerequisite to have JDK or JRE installed on your machine. In this tutorial, we are going to use the eclipse and maven plugin to build a Java based application. The following are the steps.
Step 1: – Set up JAVA_HOME and Path as windows operating system environment variables for setting up the JAVA runtime environment on Windows machine.

S No

Variable Name

Variable value



C:\Program Files\Java\jre1.8.0_91



%Path%;% JAVA_HOME%\bin;

To check the installed JAVA Version, you can open windows command prompt and issue command “java -version”. Here, we are using Java version as “1.8.0_91”.
installed JAVA Version
Step 2: – Download the maven plugin [apache-maven-3.5.0] from the following link. Unzip the package under the following path [C:\work\app].

Maven Plugin Download Link

Step 3: – Set up windows operating system environment variables as M2_REPO, PATH, MAVEN_OPTS and M2_HOME as shown below.

S No

Variable Name

Variable value












-Xms256m -Xmx512m

To verify that Maven is installed properly or not, you can open a windows command prompt and issue the command as “mvn -version”. We can see the Apache Maven version as “3.5.0” along with the JAVA version as “1.8.0_91”.
mvn -version
Step 4: – Open a new Maven Project in eclipse as shown below. Navigate in eclipse as New  others… Maven Project as shown below:
Maven Project
Step 5: – Enter the group id, artifact id and version field as the Archetype parameters are required for a maven project as shown below.
New Maven Project
Step 6: –Open pom.xml file for the maven project ‘maven_demo’. You will find the following pre-configured project level declarations as shown below.

<project xmlns="" xmlns:xsi=""





Step 7: – Maven plugin will automatically download the required APIs and set the project build path for the Java SE or J2EE application.
At this point, the installation of Apache Maven tool is completed and it is ready to be implemented in your Java/J2EE application.

Conclusion: –
In this tutorial, we discussed the Apache Maven overview, history, objectives and its conventions for a project. Later, we have demonstrated various steps to set up the Maven environment on the windows machine and used eclipse to start developing and building a Java SE/J2EE project using Maven as a project build tool.


Please enter your comment!
Please enter your name here

Exclusive content

- Advertisement -

Latest article


More article

- Advertisement -Eduonix Blog