今天学习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. 模拟远程HTTP的POST请求

    建立请求,以模拟远程HTTP的POST请求方式构造并获取处理结果 /// <summary> /// 建立请求,以模拟远程HTTP的POST请求方式构造并获取处理结果 /// </s ...

  2. ubuntu 16.04.1 nginx彻底删除与重新安装

    1.删除nginx,-purge包括配置文件 sudo apt-get --purge remove nginx 2.移除全部不使用的软件包 sudo apt-get autoremove 3.罗列出 ...

  3. iOS ItunesStore 首页推荐

    ItunesStore 首页推荐需要发给苹果一些 app 的相关信息,以及制作一个符合要求的图片. 图片要求可能经过过修改,要求会变化. 以下内容用于参考: 例子 1: Hello, My name ...

  4. Android 如何查看源码 (eclipse 按住 ctrl )

    首先要确认 Android SDK Manager 下载并安装了 sources.然后在代码中按住 ctrl 在点一个类名, 如果打开的页面是找不到源码,就点那个按钮,然后找到源码所在的文件夹,就可以 ...

  5. JSOI2008 Blue Mary开公司 | 李超线段树学习笔记

    题目链接:戳我 这相当于是一个李超线段树的模板qwqwq,题解就不多说了. 代码如下: #include<iostream> #include<cstdio> #include ...

  6. GO学习笔记 - 数据类型推导

    官方教程:https://tour.go-zh.org/basics/14 在定义一个变量却并不显式指定其类型时(使用 := 语法或者 var = 表达式语法), 变量的类型由(等号)右侧的值推导得出 ...

  7. shell脚本报错:-bash: xxx: /bin/bash^M: bad interpreter: No such file or directory

    当我们把文件从windows系统中编辑的文件拷贝到linux系统中,如果我们执行文件会保存如下的错: shell脚本报错:-bash: xxx: /bin/bash^M: bad interprete ...

  8. jQuery表单2

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. Hadoop完全分布式搭建

    ---记于2015年11月6日星期五 准备工作 软硬件环境 主机操作系统:处理器:i5,主频:3.2G,内存:8G,Windows64 虚拟机软件:VMware Workstation 10 虚拟操作 ...

  10. 【bug】记一个有趣的“bug”

    产品经理在使用我们用户功能的是,需要查询一个用户,知道这个用户的id,我说支持模糊查询的. 他输入"余XX",点击查询,怎么都查不出这个用户. 我到用户表里确认,确实有这个ID的用 ...