maven - 从父级获取属性

问题描述 投票:0回答:1

我有这个pom.xml,其中

spring.boot.version
属性在父pom中定义,

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>com.seurop.eca.ocb.middyweb.mackoffice.server</groupId>
    <artifactId>ocb-kw-mackoffice-server</artifactId>
    <version>6.0.0</version>
    <relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>ocb-kw-mackoffice-server-annotations</artifactId>
<name>ocb-kw-mackoffice-server-annotations</name>

<!-- Properties Section -->
<properties>
    <parent.version>6.0.0</parent.version>
    <eclipselink.version>2.7.12</eclipselink.version>
    <lombok.version>1.18.22</lombok.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${spring.boot.version}</version>
    </dependency>

...

尽管如此,我还是有这个错误

org.springframework.boot:spring-boot-starter-data-jpa:jar:${spring.boot.version} was not found in...
java spring-boot maven
1个回答
0
投票

spring-boot-starter-web 依赖项不包含 JPA(Java Persistence API)功能。它是一个单独的依赖项,需要显式添加。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.boot.version}</version>
</dependency>
© www.soinside.com 2019 - 2024. All rights reserved.