今天新建一个Springboot项目,然后出现报错:Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:2.5
解决方案:
1.本地maven的配置文件和仓库地址不一致
2.配置镜像源
因为网络问题导致不能下载插件,那就多配几个镜像。
配置settings.xml文件中的镜像:
<mirrors>
<!-- maven官方镜像 -->
<mirror>
<id>mirrorId</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name </name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 又一个镜像 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://central.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 阿里云镜像 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- junit镜像地址 -->
<mirror>
<id>junit</id>
<name>junit Address/</name>
<url>http://jcenter.bintray.com/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
上述问题做完后,出现其他报错:Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found
解决方案:
给spring-boot-maven-plugin加上版本,如下所示:
注意改完后可能还需要重启idea,不然错误一直会存在。