Maven не может разрешить зависимости для Spring Boot и JUnit - PullRequest
0 голосов
/ 08 апреля 2020

Я пытаюсь освоить Spring Boot и импортировать шаблон для базового приложения весенней загрузки через Spring * Starter через Spring Starter, используя мою IntelliJ IDE, но Maven не может разрешить все зависимости, и мой проект упускает важные зависимостей. Я не могу выяснить причину этого.

Сначала я подумал, что проблема заключается в использовании JDK8 для более новых версий SpringFramework, затем я установил JDK11, но та же проблема сохраняется и, насколько я понимаю, POM. xml содержит все зависимости, перечисленные в нем.

Снимок экрана IDE для получения идеи

    <?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.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.selfspring</groupId>
    <artifactId>conference-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>conference-demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>11</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>```

here is all the dependencies it is unable to resolve:

Cannot resolve org.hibernate.validator:hibernate-validator:6.0.18.Final
Cannot resolve org.hamcrest:hamcrest:2.1
Cannot resolve org.ow2.asm:asm:5.0.4
Cannot resolve org.springframework:spring-expression:5.2.5.RELEASE
Cannot resolve org.junit.platform:junit-platform-engine:1.5.2
Cannot resolve net.minidev:accessors-smart:1.2
Cannot resolve net.bytebuddy:byte-buddy:1.10.8
Cannot resolve jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
Cannot resolve org.springframework:spring-aop:5.2.5.RELEASE
Cannot resolve com.fasterxml:classmate:1.5.1
Cannot resolve org.junit.jupiter:junit-jupiter-api:5.5.2
Cannot resolve org.mockito:mockito-junit-jupiter:3.1.0
Cannot resolve org.opentest4j:opentest4j:1.2.0
Cannot resolve org.objenesis:objenesis:2.6
Cannot resolve org.springframework:spring-webmvc:5.2.5.RELEASE
Cannot resolve org.springframework.boot:spring-boot-test-autoconfigure:2.2.6.RELEASE
Cannot resolve net.bytebuddy:byte-buddy-agent:1.10.8
Cannot resolve org.junit.jupiter:junit-jupiter:5.5.2
Cannot resolve org.springframework.boot:spring-boot-test:2.2.6.RELEASE
Cannot resolve jakarta.validation:jakarta.validation-api:2.0.2
Cannot resolve org.jboss.logging:jboss-logging:3.4.1.Final
Cannot resolve net.minidev:json-smart:2.3
Cannot resolve org.springframework:spring-test:5.2.5.RELEASE
Cannot resolve org.assertj:assertj-core:3.13.2
Cannot resolve jakarta.activation:jakarta.activation-api:1.2.2
Cannot resolve org.skyscreamer:jsonassert:1.5.0
Cannot resolve org.springframework.boot:spring-boot-starter-test:2.2.6.RELEASE
Cannot resolve org.mockito:mockito-core:3.1.0
Cannot resolve com.vaadin.external.google:android-json:0.0.20131108.vaadin1
Cannot resolve com.jayway.jsonpath:json-path:2.4.0
Cannot resolve org.junit.jupiter:junit-jupiter-params:5.5.2
Cannot resolve org.xmlunit:xmlunit-core:2.6.4
Cannot resolve org.springframework:spring-jcl:5.2.5.RELEASE
Cannot resolve org.apiguardian:apiguardian-api:1.1.0
Cannot resolve org.springframework:spring-beans:5.2.5.RELEASE
Cannot resolve org.junit.jupiter:junit-jupiter-engine:5.5.2
Cannot resolve org.junit.platform:junit-platform-commons:1.5.2

1 Ответ

1 голос
/ 08 апреля 2020

Попробуйте уничтожить папку .m2, а затем снова вытащите зависимости. Обычно я делаю это так: удаляю все из .m / repo, я go в intellij и добавляю пробел в pom. xml и удаляю его, чтобы он предлагал мне извлечь изменения, сделанные в pom. xml

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...