InteliJ-新导入的Maven项目出现“无法解决”错误

时间:2020-03-03 14:18:41

标签: spring spring-boot maven intellij-idea spring-repositories

我刚刚开始学习如何使用Spring框架进行开发。我将由“ https://start.spring.io/”制作的新Java Maven项目导入了IntelliJ。

我不断收到这些错误:

Cannot resolve org.objenesis:objenesis:2.6
Cannot resolve org.assertj:assertj-core:3.13.2
Cannot resolve org.hamcrest:hamcrest:2.1
Cannot resolve net.bytebuddy:byte-buddy:1.10.8
Cannot resolve net.bytebuddy:byte-buddy-agent:1.10.8
Cannot resolve org.springframework:spring-jcl:5.2.4.RELEASE
Cannot resolve org.springframework:spring-test:5.2.4.RELEASE
Cannot resolve org.xmlunit:xmlunit-core:2.6.3
Cannot resolve org.mockito:mockito-core:3.1.0
Cannot resolve org.mockito:mockito-junit-jupiter:3.1.0

这是我的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.2.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</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-web</artifactId>
        </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>

</project>

可能是什么问题?以及如何解决?

0 个答案:

没有答案