大忙人系列_解决maven插件下载异常

当执行maven clean命令时遇到'Plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0 or one of its dependencies could not be resolved'异常,原因是maven缺少插件依赖或配置异常。解决方案包括检查阿里云私服配置和确认maven是否处于离线模式。将设置文件中<offline>true</offline>改为<offline>false</offline>,以允许在线下载缺失插件。

异常发现

我们创建的项目为maven项目,我们需要执行命令:maven clean,出现的:“Plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0 or one of its dependencies could not be resolved”异常

异常展示

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0 or one of its dependencies could not be resolved: Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public/) in offline mode and the artifact org.apache.maven.plugins:maven-clean-plugin:jar:3.0.0 has not been downloaded from it before. -> [Help 1]
[ERROR]  
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

核心在第一行意思大意如下图

问题原因

maven缺少相关的插件依赖,需要联网下载相关的插件。

解决方法

1、配置的阿里云私服配置异常(上述提示可以看出,配置地址正确)。

如果阿里云未配置,可以在maven的setting.xml中配置如下

<mirrors>
	<mirror>
		<id>nexus-aliyun</id>
		<mirrorOf>central</mirrorOf>
		<name>Nexus aliyun</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	</mirror>
  </mirrors>

2、离线无法下载。

这也是本文所遇到的问题是导致无法下载。一般会有两个原因,首先要确保自己本地是联网(如果本地都是离线那没法解决),其次就是我们在maven的setting.xml中将工作环境设置为了离线模式

解决:找到本地的maven的setting.xml文件,打开。找到“  <offline>true</offline>”修改为: “<offline>false</offline>”即可。

  <!-- 如果Maven要试图与用户交互来得到输入就设置为true,否则就设置为false,默认为true。 -->
  <interactiveMode>true</interactiveMode>
  
  <!-- 如果构建系统要在离线模式下工作,设置为true,默认为false。 如果构建服务器因为网络故障或者安全问题不能与远程仓库相连,那么这个设置是非常有用的。 -->
  <offline>false</offline>

 

要加这三个群的+微信好友:LTingUY1024(备注想加的群)

禁培训机构、禁广告推销、禁非IT行业招聘,求职。

此群的意义在于 方便成都地区IT招聘兼职、私活、学习、求职使用。

本人也将不定时的发布招聘JAVA、前端、UI等IT相关的兼职、私活工作,欢迎大家加入。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值