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]
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?