创建maven项目后Plugins爆红,如下图所示
大概率为conf文件夹下settings.xml配置不正确
可从以下几个方面先进行检查:
- 如果在公司需要使用代理上网,则首先要在settings.xml中的<proxies></proxies>添加代理设置
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>你的用户名</username>
<password>你的密码</password>
<host>你的代理ip</host>
<port>你的端口</port>
</proxy>
</proxies>
- 是否进行了镜像配置,如果没有配置,则需要在settings.xml中的<mirrors></mirrors>中添加国内阿里云的镜像
<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>
-->
<!--阿里云的镜像-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!--中央仓库在中国的位置-->
<mirror>
<id> maven-net-cn</id>
<name> Maven China Mirror</name>
<url> http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
- 是否在IDEA设置中的配置了Maven,一定注意要将settings.xml所在的位置进行覆盖设置,如下图所示,操作步骤:Maven>设置User settings file>勾选Override>Apply>OK
配置完成后保存,再到项目去测试是否解决了问题,例如org.apache.maven.plugins:maven-compiler-plugin:3.1,则先到Lifecycle中找到对应的compiler,双击运行
运行后,如果显示了BUILD SUCCESS,则表示对应的Plugins下载成功
下载成功后,右击项目,点击Reimport,则爆红会消失