创建新应用程序时无法解决 spring boot 中的依赖项

时间:2021-07-28 11:25:57

标签: spring spring-boot maven pom.xml

创建新应用程序时发生错误 n 尝试下载应用程序的 n 个构建依赖项。在 Intellij 中创建新的 Spring Boot 应用程序时无法解析依赖项。 enter image description here

解决依赖错误 无法解析 org.apache.tomcat.embed:tomcat-embed-core:9.0.50

无法解析 org.springframework.boot:spring-boot-test-autoconfigure:2.5.3

无法解析 org.springframework.boot:spring-boot-test:2.5.3

无法解析mysql:mysql-connector-java:8.0.26

无法解析 org.springframework.boot:spring-boot-starter-test:2.5.3

无法解析 org.springframework:spring-jcl:5.3.9

无法解析 org.springframework:spring-test:5.3.9

我如何解决这些问题。弹簧靴 2.5.3

2 个答案:

答案 0 :(得分:0)

试试这两件事 1> 从控制台构建项目,如果不起作用。 2> 如果是新项目,尝试使用 spring initilizr 创建项目 create project 推荐第二种方法。

答案 1 :(得分:0)

您必须转到机器上的 .m2 文件夹,具体取决于您是否使用 Windows,它应该在 C:/Users/username/.m2 并删除该文件夹的内容。

当然,您需要确保您的 pom.xml 中存在抱怨的依赖项,如果您确实拥有所有依赖项,则可以转到下一步。

回到你的 IntelliJ,你可以运行两个 maven 命令( clean , install ),你可以从 IntelliJ 的终端运行它们,也可以从位于右上角的 maven UI 运行它们IntelliJ,在数据库 UI 旁边。