您当前的位置: 首页 >  ar

liaowenxiong

暂无认证

  • 1浏览

    0关注

    1171博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

警告提示:No archetype found in remote catalog. Archetype not found in any catalog

liaowenxiong 发布时间:2022-01-29 10:12:39 ,浏览量:1

IDEA 使用 archetype(原型/模板/骨架)创建 Maven 项目时, 在这里插入图片描述 最后提示:

No archetype found in remote catalog. Defaulting to internal catalog
Archetype not found in any catalog. Falling back to central repository.
Add a repository with id ‘archetype’ in your settings.xml if archetype’s repository is elsewhere.

原因: 找不到远程的 archetype-catalog.xml,在内部的 archetype 目录册中也找不到你要的 archetype,建议你在 settings.xml 中配置 archetype 仓库。

实际上在 http://repo1.maven.org/maven2/ 仓库存在 archetype-catalog.xml 文件,下载地址:https://repo1.maven.org/maven2/archetype-catalog.xml。

但是我在 settings.xml 声明这个远程仓库后,


	repo1
	Human Readable Name for this Mirror.
	http://repo1.maven.org/maven2/
	central

在命令终端输入命令 mvn archetype:generate 同样会提示下面的警告信息:

[WARNING] No archetype found in remote catalog. Defaulting to internal catalog

我没有理解 No archetype found in remote catalog 这段文字的含义。

临时解决:

我点击上述的 archetype-catalog.xml 下载链接,下载了 archetype-catalog.xml 文件。

在这里插入图片描述

将 archetype-catalog.xml 文件移动到 ~/.m2/repository 目录下(本地仓库的根目录),然后 IDEA 中配置下面的参数: 在这里插入图片描述 然后 IDEA 使用 archetype 创建 Maven 项目,就没有上面的提示了。

其实上面的做法只是屏蔽了访问远程仓库的 catalog 而已,指定 IDEA 通过 archetype 创建项目的时候,只读取本地的 catalog。

默认是先查询远程的,再查询本地的,再查询内置的。

命令行下,你可以使用参数 archetypeCatalog=local,表示只读取本地的 catalog。参数值有三个:remote、local、internal。

[~/documents/ideaprojects]$ mvn archetype:generate -DarchetypeCatalog=local   
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO]             
关注
打赏
1661566967
查看更多评论
0.0415s