我已经在Spring Boot V-2.0.3中使用Spring Initializr创建了一个项目 我在Ubuntu机器上使用STS 3.9.4。
我遇到这些错误:
The import org.springframework.boot.autoconfigure.SpringBootApplication cannot be resolved
SpringBootApplication cannot be resolved to a type
我已经尝试过从.m2文件夹中删除存储库文件夹并点击以下命令
mvn clean dependency:tree
mvn clean compile
但是仍然无法解决错误,因为我向POM文件添加了额外依赖项
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
在执行每个步骤后,我都按照以下步骤更新了项目,但仍然无法解决错误。
STS Right click on project -> Maven -> Update Project
答案 0 :(得分:0)
转到STS右键单击项目-> Maven->更新项目。