Including Spring Boot in Project [Maven]

There are two ways to include and manage Spring Boot dependencies in project. One way is to inherit from Spring Boot parent pom, other way is to include a dependency on spring-boot-dependencies.
Code reference :

Spring Boot Parent Pom

By inheriting from Spring Boot parent pom, all the dependencies and plugin are managed by the version of parent pom. To inherit from parent pom following has to be added in pom.xml



In case one cannot inherit Spring Boot parent pom, then alternative is to declare a dependency on spring-boot-dependencies under dependencyManagement tag as shown below

              <!-- Import dependency management from Spring Boot -->

Note : Including Parent pom or spring-boot-dependencies does not actually bring in any dependencies, they are just mechanisms to manage dependencies related to Spring Boot.

Spring Boot Maven Plugin

Spring Boot Maven plugin runs in package phase to include jars in one package, so that application can be bundled as executable jar. Following has to be added in plugins for including this plugin.


If Spring Boot parent pom is not inherited, then one has to specify execution phase and plugin version explicitly as shown below


End Note

As of now project has just barebones, in next steps we will add some code so that we can see it in action.

Prev      TOC      Next