解决Maven打包时出现Maven无法下载插件的错误

发生错误原因:

(官方解释:

This error occurs when you employ a plugin that Maven could not download. Possible causes for this error are:

  1. You are referring to a non-existing plugin, e.g. by means of a typo in its group id, artifact id or version.
  2. You are using a third-party Maven plugin that is not deployed to the central Maven repository and your POM/settings is missing the required <pluginRepository> to download the plugin. Note that <repository> declarations are not considered when looking for the plugin and its dependencies, only <pluginRepositories> are searched for plugins.
  3. The plugin repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your ${user.home}/.m2/settings.xml contains a <server> declaration whose <id> matches the <id> of the plugin repository to use. See the Maven Settings Reference for more details.
  4. There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
  5. Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.
  6. The plugin repository you have configured is disabled for the specific version of the plugin you requested. For instance, if you want to use a SNAPSHOT version of a plugin, make sure you don't have <snapshots><enabled>false</enabled></snapshots> configured. Likewise, in order to resolve a released version of the plugin, the plugin repository should not be configured with <releases><enabled>false</enabled></releases>. See the POM Reference for more information on repository configuration.

In those cases, check your POM and/or settings for the proper contents. If you configured the plugin repository in a profile of your settings.xml, also verify that this profile gets actually activated, e.g. via invoking mvn help:active-profiles.

 (翻译:

跳到元数据结束
转到元数据的开始

当您使用Maven无法下载的插件时,会发生此错误。这个错误的可能原因是:

  1. 您指的是一个不存在的插件,例如通过其组ID,工件ID或版本中的拼写错误。
  2. 您正在使用未部署到中央Maven存储库的第三方Maven插件,并且您的POM /设置缺少<pluginRepository>下载插件所需的内容。请注意,<repository>查找插件及其依赖关系时不考虑声明,只<pluginRepositories>搜索插件。
  3. 您配置的插件库需要身份验证,Maven未能向服务器提供正确的凭据。在这种情况下,请确保您${user.home}/.m2/settings.xml包含一个插件库相匹配的<server>声明有关更多详细信息,请参阅Maven设置参考<id><id>
  4. 有一个普遍的网络问题,阻止Maven访问任何远程存储库,例如缺少代理配置。
  5. Maven未能将文件保存到本地存储库,请参阅LocalRepositoryNotAccessibleException获取更多详细信息。
  6. 您所配置的插件库已经被禁用了。例如,如果你想使用插件的SNAPSHOT版本,请确保你没有<snapshots><enabled>false</enabled></snapshots>配置。同样,为了解决插件的发布版本,插件库不应该被配置为<releases><enabled>false</enabled></releases>有关存储库配置的更多信息,请参阅POM参考

在这些情况下,请检查您的POM和/或设置的正确内容。如果您在您的配置文件中配置了插件存储库settings.xml,还要验证此配置文件是否真正被激活,例如通过调用mvn help:active-profiles

如果出现一般网络相关的问题,您也可以参考以下文章:

注意:出于性能原因,Maven缓存插件无法下载的信息。根据您的设置,您可能需要通过将标志添加-U到命令行来清除此缓存,以使更正生效


解决方式:

方式1:使用 mvn clean package -U 打包即可

方式2:  在setting.xml中使用原始中央仓库  就是使用默认的仓库地址


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值