Java学习者论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

恭喜Java学习者论坛(https://www.javaxxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,购买链接:点击进入购买VIP会员
JAVA高级面试进阶视频教程Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程

Go语言视频零基础入门到精通

Java架构师3期(课件+源码)

Java开发全终端实战租房项目视频教程

SpringBoot2.X入门到高级使用教程

大数据培训第六期全套视频教程

深度学习(CNN RNN GAN)算法原理

Java亿级流量电商系统视频教程

互联网架构师视频教程

年薪50万Spark2.0从入门到精通

年薪50万!人工智能学习路线教程

年薪50万!大数据从入门到精通学习路线年薪50万!机器学习入门到精通视频教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程 MySQL入门到精通教程
查看: 441|回复: 0

[默认分类] Eclipse使用Maven创建项目是报错:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quick

[复制链接]
  • TA的每日心情
    开心
    2021-12-13 21:45
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    发表于 2018-7-7 10:42:43 | 显示全部楼层 |阅读模式

    问题描述:
    使用Eclipse自带的Maven插件创建maven项目时报错:
    Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.
    Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE
    Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\Smith\.m2\repository)
    Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\Smith\.m2\repository)




    解决方案:
    在Eclipse Maven配置中添加新的Catalog配置:

      http://repo1.maven.org/maven2/archetype-catalog.xml


      



       如下图:


      

      

      接下来在使用刚添加的catalog创建maven项目:
            
       这个时候就可以看到Eclipse联网下载了:
          
    这个时候看一下是不是创建成功了
      

      如果还是不能创建或者问题没有解决可以安装下面的方法:
      1.删除maven已经下载的文件路径:.m2\repository\org\apache\maven
      删除之后再试下,这时候如果看到有进度,只需要耐心等待就行了
      

      
      How does the Archetype Plugin know about archetypes?
      
      Knowledge about archetypes is stored in catalogs.
      The catalogs are xml files: see the reference documentation.
      The Archetype Plugin comes bundled with an internal catalog. This one is used by default.
      The Archetype Plugin can use catalogs from local filesystem and from HTTP connections.
      
       Catalog file explained
       A catalog is an xml file with such content:
       
       
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <archetype-catalog  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3.   xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd">
    4.   <archetypes>
    5.     <archetype>
    6. [1]    <groupId>org.appfuse.archetypes</groupId>
    7. [2]    <artifactId>appfuse-basic-jsf</artifactId>
    8. [3]    <version>2.0</version>
    9. [4]    <repository>http://static.appfuse.org/releases</repository>
    10. [5]    <description>AppFuse archetype for creating a web application with Hibernate, Spring and JSF</description>
    11.     </archetype>
    12.     ...
    13.   </archetypes>
    14. </archetype-catalog>
    复制代码
       
       
        The groupId of the archetype. REQUIRED
        The artifactId of the archetype. REQUIRED
        The version of the archetype. RELEASE is a valid version. REQUIRED
        The repository where to find the archetype. OPTIONAL. When omitted, the archetype is searched for in the repository where the catalog comes from.
        The description of the archetype. OPTIONAL
       
      
      
       Archetype selection explained
       During the creation of a project from an archetype, the Archetype Plugin asks the user to choose an archetype from a list containing the archetypes from each of the provided catalogs (yes, there may be many).
       For each archetype in the list, the Archetype Plugin shows a line like:
       
       
    1. 1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
    复制代码
       
       
        1: The index of the archetype in the aggregated list (starting from 1).
        internal The name of the catalog where the archetype originates from.
        appfuse-basic-jsf The artifactId of the archetype.
        (AppFuse archetype...) The description of the archetype as found in the catalog.
       
      
      
       Creating a catalog file
       At the end of the create-from-project behaviour, the Archetype Plugin installs/deploys the archetype, and updates the local/remote catalog.
       The crawl-repository goal is used to create a catalog file by crawling a Maven repository located in the filesystem.
      
      
       Location of catalog files
       The Archetype Plugin knows by default about its internal catalog. It also knows about thelocal and remote catalogs.
       local represents the ~/.m2/archetype-catalog.xml catalog file.
       remote represents the http://repo.maven.apache.org/maven2/archetype-catalog.xml catalog file.
       The Archetype Plugin can also read catalogs from filesystem/HTTP by providing the path/URL of a catalog file or of a directory containing anarchetype-catalog.xml file.
      
      

      

      

      

      





    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|Java学习者论坛 ( 声明:本站资料整理自互联网,用于Java学习者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-5-5 08:51 , Processed in 0.452704 second(s), 37 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc.

    快速回复 返回顶部 返回列表