解决Intellij IDEA Maven项目导入后有红线报错的
2021-11-10 本文已影响0人
乘风破浪的姐姐
问题:首次使用IDEA,从git上拉下来的项目,打开时很多JAVA文件都有红线报错
解决方案:查看下列各项配置并更改,然后重启IEDA
1、打开 File--->Settings,查看maven设置

2、检查jdk和版本
1)打开File--->Settings--->build,execution,deployment--->Build Tools--->Maven--->Importing

2)File--->Settings--->build,execution,deployment--->Compiler--->Java Compiler

3)File--->Project Structure--->Project

4)File--->Project Structure--->Modules--->Sources

5)File--->Project Structure--->Modules--->Dependencies

6)File--->Project Structure--->SDKs

3、本地仓库镜像更改为阿里云地址
D:\software\apache-maven-3.8.1\conf下settings文件,修改如下
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
4、重新加载maven,先clean,再点击pom.xml--->maven--->Reload project,重启IDEA即可。

