今天学习maven,在控制台下新建maven项目没有问题,但是在STS(eclipse)下创建maven项目老是报错,郁闷死了:

----------------------------------------------------

错误信息:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.
Could not resolve artifact
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (F:\maven\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (F:\maven\repository)

----------------------------------------------------

遇到问题,就是baidu/google查找解决方法,可惜网上很多人提到的方法试了都不行,郁闷了好几个小时,最后找到问题原因如下:

以上报错的原因是:在settings.xml 文件中 mirrors出了问题。默认maven3.1.0安装目录下的conf目录下的setting.xml配置文件中的mirrors配置是这样的:

  1. <mirrors>
  2. <!-- mirror
  3. | Specifies a repository mirror site to use instead of a given repository. The repository that
  4. | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
  5. | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
  6. |
  7. <mirror>
  8. <id>mirrorId</id>
  9. <mirrorOf>repositoryId</mirrorOf>
  10. <name>Human Readable Name for this Mirror.</name>
  11. <url>http://my.repository.com/repo/path</url>
  12. </mirror>
  13. -->
  14. </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>
-->
</mirrors>

我也不是很清楚为什么就是不行(猜测是maven默认的internet仓库里的文件不全,所以就添加了大家用得最多的maven的internet仓库之一:lbiblio,基本所有的开源的框架的jar文件都有提供),然后在setting.xml配置文件上面我添加了一个新的mirror,添加后如下:

  1. <mirrors>
  2. <!-- mirror
  3. | Specifies a repository mirror site to use instead of a given repository. The repository that
  4. | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
  5. | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
  6. |
  7. <mirror>
  8. <id>mirrorId</id>
  9. <mirrorOf>repositoryId</mirrorOf>
  10. <name>Human Readable Name for this Mirror.</name>
  11. <url>http://my.repository.com/repo/path</url>
  12. </mirror>
  13. -->
  14. <!--以下是新增加上去的-->
  15. <mirror>
  16. <id>ibiblio.org</id>
  17. <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
  18. <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
  19. <mirrorOf>central</mirrorOf>
  20. </mirror>
  21. </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>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror> </mirrors>

就只是修改了setting.xml配置文件上的这个地方,然后在控制台下我重新输入:

mvn help:system

回车,就可以看到重新下载了好多的jar包文件。

等下载完成后,再在eclipse新建maven项目就正常了。

Maven报错:maven-archetype-webapp:RELEASE from any of the configured repositories的更多相关文章

  1. Eclipse使用Maven创建普通Java工程时错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.

    报错信息如下: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE f ...

  2. springboot maven 报错ArtifactDescriptorException

    maven具体报错提示如下: Description Resource Path Location TypeArtifactDescriptorException: Failed to read ar ...

  3. maven报错非法字符:\65279 错误

    开发中一个项目很早就报这个错,maven报错非法字符:\65279 错误,今天终于忍无可忍要解决它 :编译java文件的时候,有些java文件报非法字符 \65279错误,在网上找和很多 方法,也试了 ...

  4. 转:maven报错非法字符:\65279 错误

    开发中一个项目很早就报这个错,maven报错非法字符:\65279 错误,今天终于忍无可忍要解决它 :编译java文件的时候,有些java文件报非法字符 \65279错误,在网上找和很多 方法,也试了 ...

  5. [转]解决Maven报错"Plugin execution not covered by lifecycle configuration"

    [转]解决Maven报错"Plugin execution not covered by lifecycle configuration" 导入Myabtis源码后,POM文件会报 ...

  6. Maven报错Archive for required library:某.jar' in project '项目名'

    Maven报错Archive for required library:某.jar' in project '项目名'cannot be read or is not a valid ZIP file ...

  7. Maven 报错:Compilation of Maven projects is supported only if external build is started from an IDE.

    Maven 报错: Error:Maven Resources Compiler: Maven project configuration required for module 'yourProje ...

  8. Maven报错: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp

    郁闷了两天,创建maven项目时,eclipse报错:Could not resolve artifact org.apache.maven.archetypes:maven-archetype-we ...

  9. 关于Maven报错的一些解决办法(别处贴的)

    1.警告:The tag handler class for "s:form"(org.apache.struts2.views.jsp.ui.FormTag) was not f ...

随机推荐

  1. 国内顶尖的sql dba 团队招人。

    国内顶尖的sql dba 团队招人. 4年DBA 经验 我们希望你掌握 1.熟练关系型数据库原理.熟练一门语言(C# .Java.Python.powershell ) 2.对自动化.数据化感兴趣. ...

  2. gearman服务连接php java

    在实际工作中,会碰到两个问题 (1)现有系统想集成一个开发组件,而该组件的SDK却没有现有语言版本. (2)系统中的一项功能非常耗费资源,最好能利用其它机器来处理. 本文介绍gearman的使用,实现 ...

  3. Django博客项目思路整理

    首先明确一点,我目前学习Django是为了做一个博客,那么以博客为目标进行实践的话,按照Django的MTV模型的顺序来思考的话,要考虑如下几个事情: (Models) 1.在博客里的各种数据模型: ...

  4. Linux的思维导图

  5. java使用memcached1--安装与基本使用

    环境 CentOs6.4 libevent-2.0.22-stable memcached-1.4.24 一.memcached安装 # cd /usr/local 1.编译安装libevent # ...

  6. [Objective-C语言教程]扩展(30)

    类扩展与类别有一些相似之处,但它只能添加到编译时具有源代码的类中(类与类扩展同时编译). 类扩展声明的方法是在原始类的实现块中实现的,因此不能在框架类上声明类扩展,例如Cocoa或Cocoa Touc ...

  7. spring cloud ribbon源码解析(一)

    我们知道spring cloud中restTemplate可以通过服务名调接口,加入@loadBalanced标签就实现了负载均衡的功能,那么spring cloud内部是如何实现的呢? 通过@loa ...

  8. Java多线程——不变性与安全发布

    1.不变性 某个对象在被创建后其状态就不能被修改,那么这个对象就称为不可变对象,不可变对象一定是线程安全的.不可变对象很简单.他们只有一种状态,并且该状态由构造函数来控制. 当满足以下条件时,对象才是 ...

  9. SUSE Linux Enterprise Server设置IP地址、网关、DNS

    说明: ip:202.118.83.247 子网掩码:255.255.255.0 网关:202.118.83.2 dns:8.8.8.8 / 8.8.4.4 1.设置ip $ vi /etc/sysc ...

  10. jenkins+appium android app自动化测试

    jenkins安装 pytest+jenkins安装+allure报告 新建任务 其他默认,保存 立即构建 test_login.py from src.pages import login_page ...