我们通常在换了电脑,再重新导入之前的项目的时候会出现一系列的问题,这里面主要是项目包没导入的问题。
首先找到项目文件,找到.idea文件,再在IDEA中选择导入maven项目,IDEA会自动下载pom.xml文件中加入的包。
这里需要注意一点,有时候IDEA下载速度很慢,或者下不下来,需要在maven源目录中添加国内镜像,其操作过程如下
找到conf文件下的settings.xml,添加如下代码,再重启IDEA即可
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirrors>