Reputation: 111
Can someone explain me the difference between spring-boot-parent
and spring-boot-starter-parent
.
Examples where they have written separate modules for spring-boot-starter-parent
and spring-boot-parent
:
What's the difference between these two dependencies?
In most of the projects we generally use spring-boot-starter-parent
as parent but not spring-boot-parent
when both of them shares the same parent spring-boot-dependencies
.
Upvotes: 11
Views: 15925
Reputation: 11
I believe you meant the difference between spring-boot-starter-parent and spring-boot-starter.
Upvotes: 1
Reputation: 875
As described at https://www.baeldung.com/spring-boot-starter-parent
Spring-boot-starter-parent
The spring-boot-starter-parent project is a special starter project – that provides default configurations for our application and a complete dependency tree to quickly build our Spring Boot project.
It also provides default configuration for Maven plugins such as maven-failsafe-plugin, maven-jar-plugin, maven-surefire-plugin, maven-war-plugin.
Beyond that, it also inherits dependency management from spring-boot-dependencies which is the parent to the spring-boot-starter-parent.
spring-boot-parent
Sometimes we have a custom Maven parent. Or, we may prefer to declare all our Maven configurations manually.
In that case, we may opt to not use the spring-boot-starter-parent project. But, we can still benefit from its dependency tree by adding a dependency spring-boot-dependencies in our project in import scope.
Upvotes: 9
Reputation: 6216
Spring Boot Starter Parent helps us with managing dependency versions, the java version used by project and the default configuration for plug-ins, as we don't have to specify a lot of things manually.
It helps us with the following :
maven-failsafe-plugin
, maven-jar-plugin
and maven-surefire-plugin
etc)According to spring-boot doc :
Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop shop for all the Spring and related technologies that you need without having to hunt through sample code and copy-paste loads of dependency descriptors
The spring-boot-starter is the Core starter and provides functionalities including auto-configuration support, logging and YAML.It defines spring-boot-dependencies
as the parent pom .
In the github url that you provided , they have kept a separate module to specify the parent spring-boot-dependencies
in the pom.It might be because they needed to use the spring-boot-dependencies
, dependency tree alone without the auto-configuration and plugin configuration , and publish it as separate jar for some use-case.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${revision}</version>
<relativePath>../spring-boot-dependencies</relativePath>
</parent>
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/2.1.6.RELEASE
Upvotes: 2