You are on page 1of 13

Introduction to Maven

The java build tool provided by Apache to help in the build, documentation and dependency

process of projects with any level of complexity written in Java and C# that uses Project Object

Model (POM) and that follows the convention of source code, compiling code, and so on is

called Maven. It is kind of declarative and follows the .xml file system, and also helps in

dependency management of the build process with a consistent interface. Repositories are

used, and it is mostly considered as a project management tool as it can manage all the project

dependencies and maintenance.

What is Maven?
It means accumulator of knowledge. It is a Yiddish word that first came into the scene during

the Jakarta Turbine project, where an attempt was made to simplify the build process.

Understanding of Maven
It is a project build tool that comes under the license of Apache, and there are whole hosts of

libraries available in the Maven repository.

In a project, getting the right JAR files is a difficult task where there could be conflicts in the

versions of the two separate packages. However, It makes sure all the JAR files are present in its

repositories and avoid any such conflicting scenario.

To get those JAR files from Maven, we need to visit the Maven repository and search for the

exact dependencies, such as the Spring dependency, Hibernate dependency, etc.


Understanding the project is the first and foremost requirement in it. In a Maven project, the

file which is of utmost importance is the pom.xml file. Now, based on the dependencies, you

need to mention the exact name in this pom.xml file. For example, if you need Hibernate

dependencies, you need to specify them within the dependencies tags.

After the Project comes to the GroupId. Now, different companies or people build different

projects, which highlights the problem of making sure each project is unique. Thus, this

problem in uniqueness could be resolved by using a unique ArtifactId or GroupId, which

distinguishes one project from another. This is done by combining ArtifactId, which represents

the project name, with GroupId, which describes the package. For example, let’s say a GroupId

is named as com.telus, and ArtifactId is named as proj, then the Package name would be

com.telus.proj.web. These things would simplify the Maven process.

Top Maven companies


It has now been incorporated into many top multinational companies that want to simplify the

process of project development using a common framework that consists of all the necessary

dependencies and plugins required for a particular build in a project. Below are some of the top

corporations around the world which use it in their workflow.

1. JP Morgan Chase:- It is one of the largest Investment Banking companies which uses

Maven in a few of its Big Data Development projects.

2. Edaptive Computing Inc.:- ECI is one of the leaders in the space of automation,

optimization, and complex systems solutions that deals with a whole host of public and
private sector customers. It works with various Java projects which require its

understanding.

3. Red Hat Inc.:- It’s an American software company that creates open-source software for

the community. Red Hat has various usage of Maven.

4. One 97 Communications Ltd:- It’s an Indian mobile Internet company which deals with

hotel booking, deals, music, video games, and much more.

5. Agilysys Inc.:- It provides software for analytics, mobile solutions, document

management and so on.

Working with Maven


It has so many components which help in our projects to perform the builds by interacting with

each other. At first, a command is entered – mvn install from the command prompt.

The install command would examine the pom.xml file to understand the project and the

requirements for a build to be performed. The parts of the data that it reads are the

information of the project, which is the space where we would find a way to look for the

Artifact that would be created with the build.

The dependencies and the plugins would also be looked at. The plugins are needed to build the

Artifact as these are the actions against the code, whereas dependencies are the libraries

required for a project.

The dependency manager of Maven helps to get the plugins or the dependencies. It works in

such a way that the dependency manager would look into the pom file where the dependencies
and the plugins are listed, and then it would reach out to the individual repositories. First, the

dependency manager would search the local, and if it’s not found, then it would look into the

remote repositories like the Maven Central Repository, the Nexus Repository, etc., where the

locations to find the Artifacts would be present.

The project lifecycle would start once the plugins and the dependencies would be available. The

phases involve – compile, test, and install. All the stages would be executed along with plugins

associated with it.

Advantages of Maven
Given below are the advantages explained.

● Eases the building process for any project.

● It maintains uniformity throughout the entire build process.

● It’s very important to understand the project that we are working on. It provides

comprehensive information about the project.

● To ensure quality in a project, it’s necessary to develop it in the best possible manner,

and It provides the guidelines to do just that.

● Often in a project, it’s required to migrate to new features, and with it, the migration is

simplified.

Why should we use Maven?


The reason why we should use it.
● It is a build tool that allows generating libraries like the jar file, but the code is packaged

into a distributable library.

● Being a dependency management tool, the obtaining and the management of the

dependencies is changed then how we deal with them in general.

Scope

● It has a huge scope in today’s enterprise world. The below statistics shows that it

occupies a share of 4.2 percent in Project Portfolio Management, apart from the other

five thousand products monitored.

● In terms of industry usage, It is widely popular as well. The computer software industry

has the most usage of Apache Maven with twenty-seven percent, followed by

Information Technology at six percent and Recruiting at five percent.


● In terms of the countries which uses Apache Maven, the United States of America leads

the race with sixty-seven percent, followed by India at six percent, the United Kingdom

at six percent, and Canada at five percent.

● Based on the company size of employees, it finds its fair share of usage in large

companies having employee strength of more than a thousand, whereas mid-sized

companies have thirty-one percent, and small-sized companies with seventeen percent

use.
Why do we need it?
Any new projects require third-party libraries to work with. For example, a project which uses

MYSQL along with JAVA requires a MySQL-connector-java jar file. Additionally, working with

Spring MVC requires numerous dependencies. All these frameworks require self-downloading

all the dependencies, which are tedious and time-consuming. Moreover, in case of updating to

the latest version, it would be a challenge where we again have to visit the repositories and

download all those dependencies. It resolves this problem as it gets the necessary JAR files

required for a project and avoids any conflict

This technology used?

It is used in Java-related projects. Now, as Java is used worldwide, it enhances the importance

of Maven, and hence most companies these days look for the experience of Maven to hire

someone for a Java Development role. A recent LinkedIn search gave a whopping twenty-three

hundred results for Apache Maven skills requirement worldwide.

What is Jenkins?
Jenkins is an open-source Continuous Integration server written in Java for orchestrating a
chain of actions to achieve the Continuous Integration process in an automated fashion. Jenkins
supports the complete development life cycle of software from building, testing, documenting
the software, deploying, and other stages of the software development life cycle.
Jenkins is a widely used application around the world that has around 300k installations and
growing day by day. By using Jenkins, software companies can accelerate their software
development process, as Jenkins can automate build and test at a rapid rate.

It is a server-based application and requires a web server like Apache Tomcat. The reason
Jenkins software became so popular is that of its monitoring of repeated tasks which arise
during the development of a project. For example, if your team is developing a project, Jenkins
will continuously test your project builds and show you the errors in early stages of your
development.

What is Continuous Integration?


Continuous Integration is a process of integrating code changes from multiple developers in a
single project many times. The software is tested immediately after a code commit. With each
code commit, code is built and tested. If the test is passed, the build is tested for deployment. If
the deployment is successful, the code is pushed to production.
This commit, build, test, and deploy is a continuous process and hence the name continuous
integration/deployment.

How does Jenkins work?


Jenkins is a server-based application and requires a web server like Apache Tomcat to run on
various platforms like Windows, Linux, macOS, Unix, etc. To use Jenkins, you need to create
pipelines which are a series of steps that a Jenkins server will take. Jenkins Continuous
Integration Pipeline is a powerful instrument that consists of a set of tools designed
to host, monitor, compile and test code, or code changes,

Like

● Continuous Integration Server (Jenkins, Bamboo, CruiseControl, TeamCity, and others)


● Source Control Tool (e.g., CVS, SVN, GIT, Mercurial, Perforce, ClearCase and others)
● Build tool (Make, ANT, Maven, Ivy, Gradle, and others)
● Automation testing framework (Selenium, Appium, TestComplete, UFT, and others)

Jenkin History
● Kohsuke Kawaguchi, a Java developer, working at SUN Microsystems, was tired of
building the code and fixing errors repetitively. In 2004, created an automation server
called Hudson that automates build and test task.
● In 2011, Oracle who owned Sun Microsystems had a dispute with Hudson open source
community, so they forked Hudson and renamed it as Jenkins.
● Both Hudson and Jenkins continued to operate independently. But in short span of time,
Jenkins acquired a lot of projects and contributors while Hudson remained with only 32
projects. With time, Jenkins became more popular, and Hudson is not maintained
anymore.

Before Jenkins After Jenkins

The code is built and test as soon as Developer commits


code. Jenkin will build and test code many times during th
Once all Developers had completed their assigned
day
coding tasks, they used to commit their code all at
same time. Later, Build is tested and deployed.
If the build is successful, then Jenkins will deploy the
source into the test server and notifies the deployment
Code commit built, and test cycle was very
team.
infrequent, and a single build was done after many
days.
If the build fails, then Jenkins will notify the errors to the
developer team.

Since the code was built all at once, some


The code is built immediately after any of the Developer
developers would need to wait until other
commits.
developers finish coding to check their build

Since the code is built after each commit of a single


It is not an easy task to isolate, detect, and fix
developer, it’s easy to detect whose code caused the built
errors for multiple commits.
to fail

Code build and test process are entirely manual, Automated build and test process saving timing and
so there are a lot of chances for failure. reducing defects.

The code is deployed once all the errors are fixed


The code is deployed after every successful build and test
and tested.

The development cycle is fast. New features are more


Development Cycle is slow
readily available to users. Increases profits.

Why use Continuous Integration with Jenkins?


Some people might think that the old-fashioned way of developing the software is the better
way. Let’s understand the advantages of CI with Jenkins with the following example

Let us imagine, that there are around 10 developers who are working on a shared repository.
Some developer completes their task in 25 days while others take 30 days to complete.

Real-world case study of Continuous Integration


I am sure all of you aware of old phone Nokia. Nokia used to implement a procedure called
nightly build. After multiple commits from diverse developers during the day, the software built
every night. Since the software was built only once in a day, it’s a huge pain to isolate, identify,
and fix the errors in a large code base.

Later, they adopted Continuous Integration approach. The software was built and tested as
soon as a developer committed code. If any error is detected, the respective developer can
quickly fix the defect.

Jenkins Plugins
By default, Jenkins comes with a limited set of features. If you want to integrate your Jenkins
installation with version control tools like Git, then you need to install plugins related to Git. In
fact, for integration with tools like Maven, Amazon EC2, you need to install respective plugins in
your Jenkins.

Advantages of using Jenkins

● Jenkins is being managed by the community which is very open. Every month, they hold
public meetings and take inputs from the public for the development of Jenkins project.
● So far around 280 tickets are closed, and the project publishes stable release every
three months.
● As technology grows, so does Jenkins. So far Jenkins has around 320 plugins published in
its plugins database. With plugins, Jenkins becomes even more powerful and feature
rich.
● Jenkins tool also supports cloud-based architecture so that you can deploy Jenkins in
cloud-based platforms.
● The reason why Jenkins became popular is that it was created by a developer for
developers.

Disadvantages of using Jenkins


Though Jenkins is a very powerful tool, it has its flaws.
● Its interface is out dated and not user friendly compared to current UI trends.
● Though Jenkins is loved by many developers, it’s not that easy to maintain it because
Jenkins runs on a server and requires some skills as server administrator to monitor its
activity.
● One of the reasons why many people don’t implement Jenkins is due to its difficulty in
installing and configuring Jenkins.
● Continuous integrations regularly break due to some small setting changes. Continuous
integration will be paused and therefore requires some developer attention.

● In terms of the revenue of a company that uses it, forty-nine percent has more than

$1000m in revenue.

Advantages of CI/CD pipelines


Here are the pros/ benefits of CI/CD Pipeline:

● Builds and testing can be easily performed manually.


● It can improve the consistency and quality of code.
● Improves flexibility and has the ability to ship new functionalities.
● CI/CD pipeline can streamline communication.
● It can automate the process of software delivery.
● Helps you to achieve faster customer feedback.
● CI/CD pipeline helps you to increase your product visibility.
● It enables you to remove manual errors.
● Reduces costs and labour.
● CI/CD pipelines can make the software development lifecycle faster.
● It has automated pipeline deployment.
● A CD pipeline gives a rapid feedback loop starting from developer to client.
● Improves communications between organization employees.
● It enables developers to know which changes in the build can turn to the
brokerage and to avoid them in the future.
● The automated tests, along with few manual test runs, help to fix any issues
that may arise.

You might also like