我正在尝试动手学习Spring Boot,并使用IntelliJ IDE通过Spring Starter导入基本Spring Boot应用程序的样板,但是Maven无法解决所有依赖关系,并且我的项目缺少重要的依赖关系。我不知道原因。
首先,我认为问题是针对较新版本的SpringFramework使用JDK8,然后我安装了JDK11,但仍然存在相同的问题,据我了解,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.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
尝试nuking您的.m2文件夹,然后再次拉出依赖项。我通常这样做:从.m / repo中删除所有内容,转到intellij并在pom.xml中添加空间并删除它,这样它就可以提取在pom.xml中所做的更改。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句