我开始学习spring Boot ,我已经在努力寻找为什么我一直得到这个错误包org.springframework.boot
不存在。
我尝试将-web
添加到artifactId。
它看起来是这样的:
<artifactId>spring-boot-starter</artifactId>
这是在:
<artifactId>spring-boot-starter-web</artifactId>
这是我的pom:
<?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>io.github.yuriney</groupId>
<artifactId>vendas</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.5</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这是我的班级:
package io.github.yuriney;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class VendasApplication {
public static void main(String[] args) {
SpringApplication.run(VendasApplication.class, args);
}
}
1条答案
按热度按时间d8tt03nd1#
您可以在本地安装JDK17,并在pom.xm中调整JDK版本,然后重试。