在创建简单的spring boot
Web应用程序时遇到问题。我正在使用Intellij Idea IDE构建此应用程序。存在与依赖关系有关的问题。 Intellij在说-Dependency 'org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE' not found
(在pom.xml
中)。
详细的错误信息:
Dependency 'org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE' not found.
Tag name: artifactId Description : The unique id for an artifact produced by the project group, e.g. maven-artifact. Version : 3.0.0+
<?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.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>springboot-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-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 :(得分:5)
答案 1 :(得分:1)
如果无效 Caches / Restart...
不起作用,请从“文件 -> 设置 -> 构建、执行、部署 -> 构建工具 -> Maven”检查 Always update snapshots
。对我来说,工作就像一个魅力。
答案 2 :(得分:0)
我遇到了完全相同的问题,然后我找到了解决该问题的方法。我不是Spring Boot的专家,所以我不知道是什么原因造成的,但是我可以帮助您修复。转到https://start.spring.io/,然后转到Click on the add dependencies on the top right corner of the pic.,然后在下拉菜单下选择Spring Web,然后再次生成Initializr。