Maven - SPLessons

Maven Dependency

Chapter 8

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Maven Dependency

Maven Dependency

shape Introduction

Maven Dependency chapter explains about Dependency, Dependency Resolution and External Dependencies.

shape Description

When there is a big project, it has to be updated frequently. To automate, the project’s external JAR files have to be added. Downloading these external dependencies(JAR Files) and adding them to the existing dependencies with the correct version is a difficult task.

When a package is compiled, pom.xml file will check the Dependency information in the repository for any further jars to be included. Maven manages all these dependencies by default.

shape Examples

The following example consists of pom file with dependencies in the dependency element.

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

In the above example, two dependencies org.splessons and itoolsinfo are downloaded from the central repository and are kept in the Local repository if they are not downloaded from the local repository.

Dependency Resolution

shape Description

Every project can give its own dependencies using unique identifiers of components. While building the projects, Maven resolves the module dependencies that are already built in the following order. Maven Reactor is required when the projects in the same Maven have to run.

External Dependencies

shape Description

External dependencies are the dependencies that are not present in the Maven repository system.

shape Examples

Configuration of external dependencies can be done as follows:


In the above example, ${basedir} points to POM directories.


shape Key Points

  • Dependencies are the jar files.
  • External dependencies are added to the repository system externally.