【问题标题】:Project build error: Non-resolvable parent POM fo项目构建错误:不可解析的父 POM
【发布时间】:2019-03-31 08:09:54
【问题描述】:

这是我第一个使用 Spring Boot 的项目。所以我尝试用父级更新 pom.xml,如下所示:

<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.in28minutes.springboot</groupId>
    <artifactId>first-springboot-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <name>springboot-in-10-steps</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.BUILD-SNAPSHOT</version> <!-- lookup parent from repository -->
    </parent>

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

但是,我遇到了一个错误:

项目构建错误:不可解析的父 POM com.in28minutes.springboot:first-springboot-project:0.0.1-SNAPSHOT: 找不到工件 org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.BUILD-SNAPSHOT 和 'parent.relativePath' 指向错误的本地 POM

请帮忙!

【问题讨论】:

  • 改成&lt;relativePath/&gt;

标签: java spring eclipse maven spring-boot


【解决方案1】:

没有 2.0.0-BUILD-SNAPSHOT 这样的东西,你可能是直接从 Spring Boot 项目中复制的?

Spring Boot的发布版本可以看这里;

https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent

如果您想要最新版本,&lt;version&gt;2.0.6.RELEASE&lt;/version&gt; 可以。

如果您想使用 SNAPSHOT 或 Milestone 版本,请参阅文档

https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/getting-started-installing-spring-boot.html#getting-started-maven-installation

指定所需的存储库。

【讨论】:

  • 您的错误和 POM 明确声明;如果您希望收到正确的答案,则值得在您的问题中提供正确的信息。删除relativePath,并在eclipse中运行maven更新。
【解决方案2】:

将2.0.0.BUILD-SNAPSHOT 更改为2.0.0.RELEASE

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-16
    • 1970-01-01
    • 2020-07-09
    • 2017-12-02
    • 1970-01-01
    • 2022-11-24
    相关资源
    最近更新 更多