想起来使用Intellij idea 练习Java项目时碰到的问题,分享一下方便解决。
此次使用的Intellij idea为2020.1月的版本 。
问题描述:
在Intellij idea中创建maven项目(SpringBoot开发),在pom.xml里面填写SpringBoot依赖,希望自动下载,却始终无法成功(找了好多文档都不行)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
后来,功夫不负有心人终于找到解决方法了,二话不说,上方案。
首先,这种情况分为两种,第一种网上基本都是方法,找下就行了附赠路径: https://blog.csdn.net/yeqiuBOke/article/details/80922575
主要说下第二种:
高版本里面没有Import Maven projects automatically这个选择项 无法进行勾选。
错误演示,如下:运行时候 pom没有自动添加依赖,无法采取第一种方法解决,只能另辟路径。
会在显示里面提示@SpringBootApplication 红线,这是需要点击界面右边的Maven 点开之后 会发现Dependencies里面的org.spring......包是红色的
需要右键点击选择下载。
之后可以点击红色框上面的‘M’ 执行 idea:idea 指令
最后再次运行main方法。
Intellij idea 使用maven创建SpringBoot项目时 在pom.xml添加新依赖 无法自动更新
原文:https://www.cnblogs.com/guo-dong/p/12849713.html