问题阐述:
无论是怎么创建,都会报这个错,并且项目结构也不完整。
这个问题困扰了我一晚上,为了解决它,浏览器问了个遍。网上说的最多的解决方案就是 maven 安装的路径和和本地仓库的目录必须要保持一致(不一致就会出现这个问题)。
打开File -> Settings ->
解决办法:
这里主要还是修改本地自定义仓库文件位置以及配置 setting.xml 文件:
idea -> plugins ->maven -> lib -> maven3 -> conf -> settings.xml
修改 setting.xml 文件中的镜像源,首先找到这个标签
然后将以下代码添加到上面这个标签内部,保存退出即可:
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 波士顿木木 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
保存之后,重启打开 IDEA,按照正常程序创建项目工程,等待构建完成:
出现下面项目结构说明就已经把问题解决好了
OK,完美
希望这种解决方式对你们有帮助!!