Idea操作
1.打开配置界面,菜单栏File>Setting>Build>build Tools>Maven>Runner,或者快捷键Ctrl+Shift+S
2.勾选Delegate IDE build/run actions to Maven
3.File > invalidate Caches/Restart
4.选择Invalidate and Restart
5.如果还是报红色,请先将POM中引用的Jar包注释掉,刷新Maven后再重新引用
Idea操作
1.打开配置界面,菜单栏File>Setting>Build>build Tools>Maven>Runner,或者快捷键Ctrl+Shift+S
2.勾选Delegate IDE build/run actions to Maven
5.如果还是报红色,请先将POM中引用的Jar包注释掉,刷新Maven后再重新引用