Robbo_UK
Robbo_UK

Reputation: 12149

Spring boot default initalization relativePath

I have used the spring boot initializer to generate a project.

What does this line do? Why is it used? What would happen if its not used?

<relativePath/> <!-- lookup parent from repository -->

An extract from The pom looks like this

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.rob.jpa.troubleshooting</groupId>
    <artifactId>jpademo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>jpademo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
     ...etc

Upvotes: 8

Views: 10607

Answers (1)

Sidhu
Sidhu

Reputation: 96

It's the relative path from the module's pom.xml to the parent's pom.xml (Ref: Maven Documentation)

In your case, its not required. because parent's pom is taken from JAR file.

Scenario : If we have Application1 as parent to the module Application2, then we need to specifiy to locate the pom of Parent in the module's pom.xml

Upvotes: 1

Related Questions