创建maven工程create from archetype 很慢
通过 Intellij IDEA 新建 maven 工程时,勾选 create from archetype 不管选哪个 archetype ,创建后加载都很慢。
原因
根据 archetype 创建 maven 工程时,每次去请求 http://repo1.maven.org/maven2/archetype-catalog.xml,这个文件有 9.52M,网速不好情况下,下载非常耗时,如果是10kb/s的网速单下载这个文件就需要 15分钟。
解决思路
从官网下载catalog并缓存,以后使用本地文件
下载 catalog
下载 archetype-catalog.xml 放到用户目录下
%userprofile%/.m2
或maven仓库位置
mavenRepository\org\apache\maven\archetype\archetype-catalog\3.2.0
IDEA中设置archetype的使用方式为local
-DarchetypeCatalog=local
其他
创建 maven archetype
mvn archetype:create-from-project
参考
maven 官网-ArchetypeCatalog