前两天重装了系统,今天想写一个项目的时候出现了点问题。

在使用eclipse创建maven web项目时,点Finish后报了Could not resolve archetype的问题。

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org

网上比较流行的解决方法有两种:

1.在Eclipse Maven配置中添加新的Catalog配置

2.在本地库中装载maven-archetype-quickstart

我先试了试第一个方法,配置后没有任何效果。再用第二个方法,配置完后试着创建maven-archetype-quickstart 类型的项目创建成功,但maven web项目依然报错。

既然都没有效果,我决定自己分析下报错内容再去解决问题。

先看报错的第一句话,

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.

这段话的大致意思是:无法从任何已经配置的库里面解析 org.apache.maven.archetypes:maven-archetype-webapp:1.0。

所以我在尝试第二种办法时行不通的原因是因为缺少webapp 这个包,而我们从第二步中安装的只是maven-archetype-quickstart这个项目包。

再看第二段第一句话:从https://repo.maven.apache.org/maven2下载org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0失败。

从这里就能知道了目前的问题是org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0这个包在创建maven web项目时maven找不到,或者是找到了但没有办法解析。当找不到或者无法解析时,maven又不能从远程仓库下载下来。

所以我们可以有两种解决方法:

  1. 第一种是在本地库中装载maven-archetype-webapp ,下载 maven-archetype-webapp 包然后放到Maven 仓库对应的路径下。
  2. 第二种方法是你先删掉现在本地仓库中的maven-archetype-webapp 这个包然后创建项目,让maven自动从远程仓库获取该包。

注:maven-archetype-webapp 包的路径是(%你的默认本地仓库%\repository\org\apache\maven\archetypes\maven-archetype-webapp\1.0)

方法2的思路来自maven下载jar包到本地仓库时会产生.lastupdate文件而导致该包无法使用。


补充一个不错的方法:

先在CMD中执行mvn help:system命令行,执行后会下载很多东西,等待下载结束。

命令行执行:mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false?

此时会下载所需要的项目jar包,等待下载完毕就可以创建项目了。

解决使用eclipse创建maven web项目时报Could not resolve archetype的问题的更多相关文章

  1. Eclipse创建Maven Web项目 + 测试覆盖率 + 常见问题(2015.07.14——湛耀)

    Eclipse创建Maven web项目: 到此,并没有创建好,接下来一步步解决问题: 问题:无法创建src/main/java目录 解决: 右键项目选择[properties] 点击[OK] 问题: ...

  2. Eclipse创建Maven Web项目后更改Servlet版本

    Eclipse创建Maven Web项目后更改Servlet版本 1.场景基于Eclipse通过maven-archetype-webapp原型创建一个Web项目后,其默认Servlet版本是2.3, ...

  3. Java归去来第2集:利用Eclipse创建Maven Web项目

    一.前言 如果还不了解剧情,请返回第一集的剧情          Java归去来第1集:手动给Eclipse配置Maven环境 二.利用Eclipse创建Maven Web项目 选择File-New- ...

  4. eclipse 创建maven web项目

    参考:http://www.cnblogs.com/hongwz/p/5456616.html eclipse 创建maven web项目

  5. eclipse创建maven web项目

    eclipse创建maven web项目: 1.安装eclipse maven插件 2.新建maven project选择webapp模板. 3.改造为maven文档结构. 4.添加项目的JAVAEE ...

  6. eclipse创建Maven Web项目以及无法修改Project Facets

    1.在eclipse中创建maven项目,在菜单栏的:File-->New-->other中,搜索maven则会出现Maven Project; 2.点击next继续; 3.点击next继 ...

  7. eclipse创建maven web项目工程步骤示例

    参考链接:https://www.cnblogs.com/noteless/p/5213075.html 需求表均同springmvc案例 此处只是使用maven 注意,以下所有需要建立在你的ecli ...

  8. Eclipse创建Maven时提示错误could not resolve archetype

    今天用Eclipse创建Maven多模块项目的时候提示错误: could not resolve archetype ******release from any of the configured ...

  9. eclipse创建Maven web项目的步骤

    Maven 是一个项目管理工具,可以对 Java 项目进行构建.依赖管理. Maven 能够帮助开发者完成以下工作: 构建 文档生成 报告 依赖 SCMs 发布 分发 邮件列表 一.环境配置 Mave ...

随机推荐

  1. 怎么才能使服务器Nginx(或者Apache)支持字体文件

    为了在前端正确地显示字体,浏览器必须使用正确的http header来接受字体文件.如果服务器没有设置要求的头信息,那么有些浏览器就会在控制台报错或者直接不能显示. 可能你的服务器已经配置好了,你无须 ...

  2. VUE组件的学习

    参考:https://blog.csdn.net/baidu_23142899/article/details/79130225

  3. Galera Cluster mysql+keepalived集群部署

    1.卸载mysql 查找本机安装的mysqlrpm -qa | grep -i mysql --nodeps --force rpm -ev MySQL-server-5.6.15-1.el6.x86 ...

  4. vue里v-for下的key的作用

    将v-for的元素赋予唯一的key属性,则会打破‘就地复用原则’: 这个就地复用原则是指 如果数据项的顺序被改变,Vue 将不会移动 DOM 元素来匹配数据项的顺序, 而是简单复用此处每个元素,并且确 ...

  5. Java编程基础篇第二章

    关键字 概述:被Java语言赋予特定含义的单词. 特点:组成关键字的字母全部为小写字母. 标识符 概述:给类,接口,包,方法,常量起名字时的字符序列 组成规则:英文大小写字母,数字,$和— 命名规则. ...

  6. Java程序员必会英语单词

    Complie: 编译 line: 行 variable: 变量 parameter: 参数 defaul: 默认 access: 访问 operation:  操作运算 member-variabl ...

  7. python全栈开发 * 24 知识点汇总 * 180705

    24 模块-------序列化一.什么是模块 模块:py文件就是一个模块.二.模块的分类:(1)内置模块 (登录模块,时间模块,sys模块,os模块)(2)扩展模块 (itchat 微信有关,爬虫,b ...

  8. 最短路(SPFA)

    SPFA是Bellman-Ford算法的一种队列实现,减少了不必要的冗余计算. 主要思想是: 初始时将起点加入队列.每次从队列中取出一个元素,并对所有与它相邻的点进行修改,若某个相邻的点修改成功,则将 ...

  9. 使用PyQT开发图形界面程序

    环境 python:v3.3 PyQT:v4.10.4 注意问题: 在主文件前面加入,否则当前的工程模块无法找到 import sys sys.path.append(".") 入 ...

  10. SyntaxError:unexpected EOF while parsing(<string,line 0>)

    在python+Django中出现报错:(上图) 经断点发现:python内置函数eval在处理空字符串时会返回EOF错误,判断后解决