Intellij 在 pom.xml 中找不到 Maven 依赖项

我是 Spring Boot 框架的新手,我正在尝试导入 Maven 库,但是我的 pom.xml 一直出现错误。请帮忙!


org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from https://repo.maven.apache.org/maven2传输失败被缓存在本地存储库中,不会重新尝试解析直到 Central 的更新间隔已过或强制更新。原始错误:无法传输工件 org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to central ( https://repo.maven.apache.org/maven2):repo。 maven.apache.org


依赖 'org.springframework.boot:spring-boot-starter-web:' not found less... (Ctrl+F1) 检查信息:检查 Maven 模型的解决问题。


插件 'org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE' not found less... (Ctrl+F1) 检查信息:检查 Maven 模型以解决问题。


下面是我的 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>


<groupId>com.cierra</groupId>

<artifactId>spring-boot</artifactId>

<version>0.0.1-SNAPSHOT</version>


<parent>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-parent</artifactId>

    <version>2.0.4.RELEASE</version>

</parent>



<dependencies>

    <dependency>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-web</artifactId>

    </dependency>

</dependencies>


<properties>

    <java.version>1.8</java.version>

</properties>


<build>

    <plugins>

        <plugin>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-maven-plugin</artifactId>

            <version>2.0.4.RELEASE</version>

        </plugin>

    </plugins>

</build>



</project>


holdtom
浏览 720回答 3
3回答

缥缈止盈

这可能是由于它无法连接和传输 pom.xml 文件中指定的依赖项的原因。必须在 .m2 文件夹下的 settings.xml 中提及它尝试连接的详细信息尝试在 pom.xml 文件中添加 pluginRepositories:<pluginRepositories>&nbsp; &nbsp; <pluginRepository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-snapshots</id>&nbsp; &nbsp; &nbsp; &nbsp; <url>http://repo.spring.io/libs-snapshot</url>&nbsp; &nbsp; &nbsp; &nbsp; <snapshots>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <enabled>true</enabled>&nbsp; &nbsp; &nbsp; &nbsp; </snapshots>&nbsp; &nbsp; </pluginRepository></pluginRepositories>尝试在 pom.xml 中的 repositories 元素中添加以下存储库元素<repository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-snapshots</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Snapshots</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/snapshot</url>&nbsp; &nbsp; &nbsp; &nbsp; <snapshots>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <enabled>true</enabled>&nbsp; &nbsp; &nbsp; &nbsp; </snapshots>&nbsp; &nbsp; </repository>&nbsp; &nbsp; <repository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-milestones</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Milestones</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/milestone</url>&nbsp; &nbsp; &nbsp; &nbsp; <snapshots>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <enabled>false</enabled>&nbsp; &nbsp; &nbsp; &nbsp; </snapshots>&nbsp; &nbsp; </repository>如果此设置良好,请更改您的 updatePolicy 设置。&nbsp;<repository>&nbsp; &nbsp; &nbsp; <id>myRepo</id>&nbsp; &nbsp; &nbsp; <name>My Repository</name>&nbsp; &nbsp; &nbsp; <releases>&nbsp; &nbsp; &nbsp; &nbsp; <enabled>false</enabled>&nbsp; &nbsp; &nbsp; &nbsp; <updatePolicy>always</updatePolicy>&nbsp; &nbsp; &nbsp; &nbsp; <checksumPolicy>warn</checksumPolicy>&nbsp; &nbsp; &nbsp; </releases>&nbsp; &nbsp; &nbsp;</repository>

萧十郎

问题是我在阻止我的 pom.xml 正常运行的代理后面。使用 VPN 运行应用程序后,它现在工作正常。

慕丝7291255

再次更改您的 Maven 版本广告检查。安装 Maven,然后转到 File/setting/build,execution,.../build Tools/maven 并将 Maven 主目录更改为您的安装 Maven 目录
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java