In this lesson, you will learn about build systems, Maven and Gradle.
But before we discuss Maven and Gradle, let’s first talk about Dependency Management
What is Dependency Management?
According to the Maven documentation, dependency management is “a mechanism for centralizing dependency information”.
About Dependency
First, let’s understand what dependency is. So when you are developing an application, you would probably need a number of libraries(normally jar files). It means that your application depends of these libraries. Hence the name dependency.
Now you need a way to assemble all these libraries and manage them in a centralized fashion. This also means that these libraries would be made available at compile time or runtime when needed. This is what dependency management does.
So the process of dependency management involves locating these dependencies and adding them to the classpath.
Maven Dependency Management
When you want to create a new project, you probably see that you can create Maven project. Now Maven is a popular dependency management tool. If you choose to create a Maven project, then you are simply saying that you would like to use Maven to manage dependencies.
If you are creating a spring application however, spring boot provides you with the initial dependencies you need for your application. But then, you can still add more from Maven Central Repository
You already know how to do this from Tutorial 3 and Tutorial 4.
Maven Central Repository
You can find hundreds of dependencies hosted in this repository. You simply need to search for it, then copy it to your pom.xml <dependencies></dependencies> section.
Structure of the dependencies section of the pom.xml file is shown below
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.1.2.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.1.3.RELEASE</version> </dependency> </dependencies>
Watch the Video
Favor enviar
Nice explanation
Thank you so much
Many thanks too?
I am currently using your tutorial to learn spring boot and I must congratulate you cause this is the best tutorial I have seen out here. Everything is explained pretty well and I am learning. Thank you.