Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 528
Robbo_UK Avatar asked Nov 08 '22 19:11

Robbo_UK


1 Answers

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

like image 117
Sidhu Avatar answered Dec 09 '22 22:12

Sidhu