Maven Beginners Tutorial

Maven Tutorial

Introduction to Maven

Maven is a build automation tool used primarily for Java projects. Maven addresses two important aspects of building software:
First: It describes how software is built
Second: It describes its dependencies.

Unlike earlier tools like Apache Ant, it uses conventions for the build procedure and only exceptions need to be written down.

An XML file describes the software project being built, its dependencies on other external modules and components, the build order, directories, and required plug-ins.

It comes with pre-defined targets for performing certain well-defined tasks such as compilation of code and its packaging.

What Is a Build Tool?

Build tools are programs that automate the creation of executable applications from source code. The building incorporates compiling, linking and packaging the code into a usable or executable form.

In small projects, developers will often manually invoke the build process. This is not practical for larger projects.

Where it is very hard to keep track of what needs to be built, in what sequence and what dependencies there are in the building process. Using an automation tool like Maven, Gradle or ANT allows the build process to be more consistent.

Few of the important features of Maven are:

Ø  Simple project setup that follows best practices - get a new project or module started in seconds.

Ø  Consistent usage across all projects - means no ramp-up time for new developers coming onto a project.

Ø  Superior dependency management including automatic updating, dependency closures (also known as transitive dependencies)

Ø  Able to easily work with multiple projects at the same time

Ø  Extensible, with the ability to easily write plugins in Java or scripting languages

Ø  Instant access to new features with little or no extra configuration

Build Life cycles In Maven

Build lifecycle is a list of named phases that can be used to give order to goal execution.
One of Maven's standard life cycles is the default lifecycle, which includes the following phases, in this order

1 validate
2 generate-sources
3 process-sources
4 generate-resources
5 process-resources
6 compile
7 process-test-sources
8 process-test-resources
9 test-compile
10 test
11 package
12 install
13 deploy

Plugins In Maven

Most of Maven's functionality is in plugins. A plugin provides a set of goals that can be executed using the following syntax:

mvn [plugin-name]:[goal-name]

For example, a Java project can be compiled with the compiler plugins compile-goal by running mvn compiler: compile . There are Maven plugins for building, testing, source control management, running a web server, generating Eclipse project files, and much more. Plugins are introduced and configured in a <plugins>-section of a pom.xml file.
Some basic plugins are included in every project by default, and they have sensible default settings.

POM In Maven

A Project Object Model (POM) provides all the configuration for a single project. General configuration covers the project's name, its owner and its dependencies on other projects.

One can also configure individual phases of the build process, which are implemented as plugins.

For example, one can configure the compiler-plugin to use Java version 1.5 for compilation, or specify packaging the project even if some unit tests fail.

Larger projects should be divided into several modules, or sub-projects, each with its own POM. One can then write a root POM through which one can compile all the modules with a single command. POMs can also inherit configuration from other POMs.

All POMs inherit from the Super POM by default. The Super POM provides default configuration, such as default source directories, default plugins, and so on.

Maven Archetype

An archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made.

Maven Artifact

In Maven artifact is simply a file or JAR that is deployed to a Maven repository. An artifact has
-Group ID
-Artifact ID
-Version string.
The three together uniquely identify the artifact. All the project dependencies are specified as artifacts.



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
August 4, 2020 at 8:50 AM

The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Projects for CSE.

Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training