使用eclipse创建maven项目出现的一个问题

简介: 错误信息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.

错误信息

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.

In case of a general network-related problem, you could also consult the following articles:

Configuring a Proxy
Security and Deployment Settings
Guide to Remote Repository Access through Authenticated HTTPS
Note: For performance reasons, Maven caches the information that the plugin could not be downloaded. Depending on your setup, you might need to clear this cache by adding the flag -U to the command line for your corrections to take effect.

原因分析

根据提示,查找该错误的官方分析链接
当您使用Maven无法下载的插件时,会发生此错误。这个错误的可能原因是:

  1. 您指的是一个不存在的插件,例如通过其组ID、工件ID或版本中的键入。
  2. 您正在使用未部署到中央Maven存储库的第三方Maven插件,而您的POM/设置缺少所需的“插件库”来下载插件。注意,在查找插件及其依赖项时,不考虑“存储库>声明”,只搜索插件库。
  3. 您配置的插件库需要身份验证,Maven无法向服务器提供正确的凭据。在这种情况下,请确保${Huff.Hoe}//M2/Stuts.xml包含一个
  4. 存在一个一般的网络问题,它阻止Maven访问任何远程存储库,例如缺少的代理配置。
  5. Maven无法将文件保存到本地存储库中,请参阅LoalAlpLogiTyNoAccess。
  6. 您所配置的插件库对于请求的插件的特定版本是禁用的。例如,如果您想使用插件的快照版本,请确保没有“快照> <启用”>错误/启用> <快照>。同样,为了解决插件的发布版本,插件库不应该被配置为<发行> >启用>错误> /使能> /发行版>。有关存储库配置的更多信息,请参见POM参考。
  7. 在这些情况下,检查您的POM和/或设置的适当内容。如果您在Stutux.xml的配置文件中配置了插件库,还验证此配置文件实际上被激活,例如通过调用MVN帮助:活动配置文件。
  8. 在一般网络相关问题的情况下,您也可以参考以下文章:
    • 配置代理
    • 安全和部署设置
    • 通过认证HTTPS的远程存储库访问指南

解决方法:

  1. 删除maven库里面文件:.m2\repository\org\apache\maven\plugins
    右击maven项目,maven->update project,利用eclipse重新下载本地仓库
    参考文章
    • 效果:没有作用
  2. 修改pom.xml文件

    1. 在pom.xml中添加新的dependency:
      <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <type>maven-plugin</type> </dependency>
      • 效果: 没有作用
    2. 在build中添加:
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven.compiler.plugin</artifactId>
              <configuration>
              <source>1.5</source>
              <target>1.5</target>
              <verbal>true</verbal>
              </configuration>
           </plugin>
         </plugins>
        </build>
    • 效果:没有作用
  3. 更改setting.xml 文件的mirror镜像

    1. 更改为
      <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://mvnrepository.com/</url> </mirror>
      • 没有作用
    2. 更改为
      <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror>
      • 下载很慢,有作用

以上解决办法是基于我公司内部网络的情况下进行,我的没有作用不代表不好使.最后在一个文章中发现, https://repo.maven.apache.org/maven2网站被禁,不知道消息是否靠谱.

目录
相关文章
|
4天前
|
Java Maven
2022最新版超详细的Maven下载配置教程、IDEA中集成maven(包含图解过程)、以及导入项目时jar包下载不成功的问题解决
这篇文章是一份关于Maven的安装和配置指南,包括下载、环境变量设置、配置文件修改、IDEA集成Maven以及解决jar包下载问题的方法。
2022最新版超详细的Maven下载配置教程、IDEA中集成maven(包含图解过程)、以及导入项目时jar包下载不成功的问题解决
|
3天前
|
Java 应用服务中间件 Maven
Mac使用Idea配置传统SSM项目(非maven项目)
Mac使用Idea配置传统SSM项目(非maven项目)
12 1
|
4天前
|
XML JSON Java
使用IDEA+Maven搭建整合一个Struts2+Spring4+Hibernate4项目,混合使用传统Xml与@注解,返回JSP视图或JSON数据,快来给你的SSH老项目翻新一下吧
本文介绍了如何使用IntelliJ IDEA和Maven搭建一个整合了Struts2、Spring4、Hibernate4的J2EE项目,并配置了项目目录结构、web.xml、welcome.jsp以及多个JSP页面,用于刷新和学习传统的SSH框架。
12 0
使用IDEA+Maven搭建整合一个Struts2+Spring4+Hibernate4项目,混合使用传统Xml与@注解,返回JSP视图或JSON数据,快来给你的SSH老项目翻新一下吧
|
4天前
|
Java Maven
成功解决IDEA中建立新项目Maven会默认选择配置(图解详细说明)
这篇文章提供了在IntelliJ IDEA中设置新项目的Maven配置的详细步骤,包括如何通过菜单路径进入设置,选择Maven配置,以及展示设置后的效果,还提供了Maven的安装教程和解决导入项目时jar包下载问题的方案。
成功解决IDEA中建立新项目Maven会默认选择配置(图解详细说明)
|
4天前
|
SQL 前端开发 Java
在IDEA中使用Maven将SpringBoot项目打成jar包、同时运行打成的jar包(前后端项目分离)
这篇文章介绍了如何在IntelliJ IDEA中使用Maven将Spring Boot项目打包成可运行的jar包,并提供了运行jar包的方法。同时,还讨论了如何解决jar包冲突问题,并提供了在IDEA中同时启动Vue前端项目和Spring Boot后端项目的步骤。
在IDEA中使用Maven将SpringBoot项目打成jar包、同时运行打成的jar包(前后端项目分离)
|
8天前
|
Java Apache Maven
Maven 项目文档
本章介绍如何创建Maven项目文档。例如,在C:/MVN下创建名为`consumerBanking`的项目,可通过命令`mvn archetype:generate`快速搭建。之后需在`pom.xml`中添加或更新插件配置,如`maven-site-plugin`版本至3.3,以避免运行`mvn site`时遇到类未找到错误。这确保文档能成功生成。
|
8天前
|
XML Java Maven
"Maven项目模块化大揭秘!掌握Model间最佳继承设计,让你的代码优雅如诗,项目维护不再愁!"
【8月更文挑战第11天】Maven是Java项目中常用的构建工具,其模块化特性对大型项目的管理至关重要。本文介绍Maven中的继承与聚合机制,指导如何通过继承消除重复配置,以及如何通过聚合统一构建多个模块。遵循单一职责原则,文章建议按功能划分模块,并提供了父POM与子POM的配置示例。此外,还讨论了适度模块化、依赖管理的原则,帮助提升项目的可维护性和扩展性。
21 4
|
6天前
|
Java Apache Maven
Maven 项目文档
本章介绍如何创建Maven项目文档。以在C:/MVN下建立的`consumerBanking`项目为例,利用`mvn archetype:generate`命令快速搭建Java项目骨架。为避免运行`mvn site`时出现`NoClassDefFoundError`错误,需在`pom.xml`中升级`maven-site-plugin`至3.3版本,并加入`maven-project-info-reports-plugin`插件以完善站点文档生成配置。
|
10天前
|
Java Apache Maven
Maven 项目文档
本章介绍如何创建Maven项目文档,例如在C:/MVN下使用`mvn archetype:generate`命令快速搭建`consumerBanking`项目。需配置pom.xml,添加maven-site-plugin 3.3及maven-project-info-reports-plugin 2.7,避免运行`mvn site`时出现类未定义错误,确保文档生成顺利。
|
14天前
|
Java Apache Maven
Maven 项目文档
本章介绍如何创建Maven项目文档。例如,在`C:/MVN`目录下使用命令`mvn archetype:generate`创建`consumerBanking`项目。需在`pom.xml`中添加配置以避免运行`mvn site`时出现`NoClassDefFoundError`错误,这通常是因为`maven-site-plugin`版本较低,升级至3.3或以上版本可解决。

推荐镜像

更多