【问题标题】:Getting Project build error: Non-resolvable parent POM error in pom获取项目构建错误:pom 中不可解决的父 POM 错误
【发布时间】:2020-06-13 07:33:31
【问题描述】:

我通过 spring initializr 创建了 spring boot 项目,在导入新的 maven 项目时,eclipse 显示以下错误。注意:我使用的是 eclipse Luna(32 位)和 java 1.8。

Project build error: Non-resolvable parent POM: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.3.1.RELEASE from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.1.RELEASE from/to central (http://repo.maven.apache.org/maven2): Failed to transfer http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.1.RELEASE/spring-boot-starter-parent-2.3.1.RELEASE.pom. Error code 501, HTTPS Required and 'parent.relativePath' points at no local POM.

这是我的 pom.xml 文件代码。

<?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.3.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.project</groupId>
<artifactId>JodiMilaye</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>JodiMilaye</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-thymeleaf</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.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </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>

【问题讨论】:

  • 确保您已正确导入项目。如果您已经从 spring 初始化程序创建了项目,请确保在解压缩和导入时导入包含 pom 和 .project 的文件夹,而不是高于此级别。

标签: spring eclipse spring-boot


【解决方案1】:

尝试将以下内容添加到您的 pom 中,然后再次尝试构建 添加此子代码后,它对我有用,谢谢

<repositories>

    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>

</repositories>

【讨论】:

  • 如果这不起作用,请在删除 .m2 目录后尝试构建
猜你喜欢
  • 2019-03-31
  • 1970-01-01
  • 2017-04-16
  • 2020-07-09
  • 2017-12-02
  • 1970-01-01
  • 2016-07-26
相关资源
最近更新 更多