Course – LS – All

Get started with Spring and Spring Boot, through the Learn Spring course:


1. Introduction

Maven is a project management and comprehension tool. It is based on the concept of the project object model, also known as POM. Using the POM as a central piece of information, Maven can manage a project’s build, reporting, and documentation.

A big part of Maven is dependency management. Most developers will interact with this feature of Maven while working on an application.

Maven’s superior dependency management provides automatic updating as well as dependency closure. Another way companies use Maven for dependency management is by using a custom central repository. By doing so, developers can use their own dependencies on other projects within the company.

In this tutorial, we’ll learn how to find Maven dependencies.

2. What Is a Maven Dependency

In the context of Maven, a dependency is simply a JAR file used by a Java application. Based on the POM file, Maven will download and add the JAR file to our Java path. Java will then be able to find and use the classes in the JAR file.

It is also important to note that, Maven has a local repository where it downloads all the dependencies. By default, this is located in the {user home folder}/.m2/repository.

3. POM File

The POM file uses the XML syntax, where everything is between tags.

By default, the POM file is populated only with our project information. In order to add dependencies that our project will use, we need to add the dependencies section:

<project xmlns=""


This is only needed when we manually edit the POM file.

4. Ways to Find Maven Dependencies

When working on a new project or adding a new feature, we may realize that we need to add a new dependency to our project. Let’s take a simple example where we need to add the JDBC dependency.

Depending on our IDE and setup, there are different ways to find the needed details for the JDBC dependency.

4.1. IntelliJ

If we use IntelliJ IDEA, we can add a new dependency to the project’s POM by following a few steps.

Firstly, we open the POM file, then press ALT+INSERT and then click on the DEPENDENCY option:IntelliJ Add Dependency Context Menu

Then, we can search for the needed dependency and click ADD:IntelliJ Dependency Search

4.2. Eclipse

Eclipse IDE has a similar way to IntelliJ for adding a new dependency.

We need to right-click on the POM file in the package explorer or after opening the file, and then we go to Maven -> Add dependency option:

Eclipse Maven Context MenuThen, we can search for the needed dependency and click OK:Eclipse Dependency Search

If we are ok with manually editing the POM file, then we can simply search on or Google to find all the details of the dependency.

When going to, we can simply type the dependency in the search bar, and we’ll find plenty of versions of the dependency. Unless there are other restrictions in our project, we should use the latest stable version:

SearchMaven DependencySearch

In our POM file, in the dependency section, simply paste the dependency details found.


There are also plenty of other websites similar to that we can use and explore.

5. Conclusion

In this tutorial, we saw the different ways to add a Maven dependency to our project.

We also learned how to edit the POM file to get Maven to download and use the dependency added.

Course – LS – All

Get started with Spring and Spring Boot, through the Learn Spring course:

res – Maven (eBook) (cat=Maven)
Inline Feedbacks
View all comments
Comments are closed on this article!