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

在使用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. DBeaver连接MySQL 8.0显示"Unable to load authentication plugin 'caching_sha2_password'."错误的问题

    下载MySQL绿色版本mysql-8.0.12-winx64,手动安装完成后.使用DBeaver连接提示"Unable to load authentication plugin 'cach ...

  2. NodeJs使用nodejs-websocket + protobuf

    参考: HTML5+NodeJs实现WebSocket即时通讯 (某人的blog) nodejs-websocket使用示例 (www.npmjs.com网站,有示例) Buffer API (nod ...

  3. python __get__ & __set__

    目的:  提供类似java中的getter/setter的东西. (getter/setter的目的: 将属性方法化,使得属性的引用变得简单---尤其将来属性的读取/赋值有比较复杂的逻辑) 官方简明文 ...

  4. java源码中的注解

    spring框架源码中充满了注解,如果对注解不是很了解,阅读源码就寸步难行,下面我们来看看annotation.https://blog.csdn.net/briblue/article/detail ...

  5. MySQL数据查询

    数据查询语言DQL select [all | distinct] 字段或表达式列表 [from子句] [where子句] [group by子句] [having子句] [order by子句] [ ...

  6. A股时间窗口

    春节躁动行情:大消费,文娱影视 一号文件:泛农业股 两会行情:两会概念 糖酒会:白酒,糖业 五穷六绝:半年节点,[市场缺钱] 暑期档:文娱影视 国庆行情:军工,文娱影视 年底:阳历年底,[市场缺钱] ...

  7. 关于break,return,和coutiune

    public boolean searchStudent(String name,int start,int end) { if(students==null) { return false; } f ...

  8. qt 操作注册表,设置ie代理

    void SetIEProxy(QString proxy) { QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Wi ...

  9. .net 平台 统计图表展示控件fusioncharts

    https://www.fusioncharts.com/javascript-chart-fiddles/

  10. nginx 反向代理时丢失端口的解决方案

        今天,配置nginx反向代理时遇到一个问题,当设置nginx监听80端口时转发请求没有问题.但一旦设置为监听其他端口,就一直跳转不正常:如,访问欢迎页面时应该是重定向到登录页面,在这个重定向的 ...