h Kishore
h Kishore

Reputation: 111

Need to know the difference between spring-boot-starter-parent and spring-boot-parent

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

Answers (3)

Karen
Karen

Reputation: 11

I believe you meant the difference between spring-boot-starter-parent and spring-boot-starter.

  • spring-boot-starter-parent - has spring-boot-dependencies as the parent and hence provides various spring-boot dependencies and helps in dependency management. In addition to this spring-boot-starter-parent on it's own helps in plugin management as well. So if you use only spring-boot-dependencies you can benefit from the dependency management provided by it but instead if you use the spring-boot-starter-parent, you get dependency management + plugin management.
  • spring-boot-starter - It is a dependency provided by spring-boot-dependencies which provides dependencies for autoconfigure, logging and also spring-core. In order to pull any dependency from the starter or from spring-boot-dependencies, you need to explicitly add it as a dependency in your main pom.

Upvotes: 1

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

Ananthapadmanabhan
Ananthapadmanabhan

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 :

  • Configuration
  • Dependency management
  • Default plugin configuration (default configurations for 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

Related Questions