Hamza Belmellouki
Hamza Belmellouki

Reputation: 2736

Why spring-boot-build parent dependency is missig?

I know that when I am inheriting from spring-boot-starter-parent I'll have this inheritance chain:

my-project => spring-boot-starter-parent => spring-boot-dependencies => spring-boot-build => maven parent pom

=>(means inherit)

Indeed That's what I saw in Github. And I believe It is true.

But when I am navigating through these POMs on my IDE (IntelliJ) the spring-boot-dependencies does not declare a parent pom (which should be spring-boot-build according to GitHub)

No parent pom specified

Why there is no inheritance specified in spring-boot-dependencies in my IDE(there is one GitHub)? I am missing something?

Edit

My project's pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Upvotes: 0

Views: 118

Answers (1)

dunni
dunni

Reputation: 44555

It doesn't show the parent POM relation in your IDE, because in the pom file for spring-boot-dependencies, that's deployed to the central Maven repository, there is no parent tag: https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.2.0.RELEASE/pom Eclipse will load that pom file, not the one from the source repository.

So it looks that the build process from Spring Boot removes the parent tag, when it's deploying the pom to Maven Central.

A reason for this could be (and the naming suggests it), that spring-boot-build only provides configuration and dependencies related to the build process for Spring Boot itself, but isn't necessary or desired for applications using it.

Upvotes: 1

Related Questions