发生错误原因:
(官方解释:
This error occurs when you employ a plugin that Maven could not download. Possible causes for this error are:
- You are referring to a non-existing plugin, e.g. by means of a typo in its group id, artifact id or version.
- 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. - 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. - There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
- Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.
- 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无法下载的插件时,会发生此错误。这个错误的可能原因是:
- 您指的是一个不存在的插件,例如通过其组ID,工件ID或版本中的拼写错误。
- 您正在使用未部署到中央Maven存储库的第三方Maven插件,并且您的POM /设置缺少
<pluginRepository>
下载插件所需的内容。请注意,<repository>
查找插件及其依赖关系时不考虑声明,只<pluginRepositories>
搜索插件。 - 您配置的插件库需要身份验证,Maven未能向服务器提供正确的凭据。在这种情况下,请确保您
${user.home}/.m2/settings.xml
包含一个与插件库相匹配的<server>
声明。有关更多详细信息,请参阅Maven设置参考。<id>
<id>
- 有一个普遍的网络问题,阻止Maven访问任何远程存储库,例如缺少代理配置。
- Maven未能将文件保存到本地存储库,请参阅LocalRepositoryNotAccessibleException获取更多详细信息。
- 您所配置的插件库已经被禁用了。例如,如果你想使用插件的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中使用原始中央仓库 就是使用默认的仓库地址