idea maven创建web项目特别慢的解决方案

idea maven创建web项目特别慢的解决方案

maven创建一个项目的时候需要下载一个文件archetype-catalog.xml,

用idea创建maven项目时,idea会根据maven archetype的配置,执行mvn archetype:generate命令,该命令执行时,需要指定一个archetype-catalog.xml文件。

该命令的参数-DarchetypeCatalog,可选值为:remote,internal ,local等,用来指定archetype-catalog.xml文件从哪里获取。

默认为remote,即从 https://repo1.maven.org/maven2/archetype-catalog.xml路径下载archetype-catalog.xml文件。

https://repo1.maven.org/maven2/archetype-catalog.xml 文件约为10M,从maven中央仓库下载(在国外),就会导致下载速度很慢,从而创建过程经常会被卡住。

解决方案:下载一个文件archetype-catalog.xml到你的本地仓库根目录(文件下载在最后),你的仓库位置如图查看

img

然后把archetype-catalog.xml拉到你的仓库

img

然后在idea中按照下图设置-DarchetypeCatalog=local就🆗啦

img

archetype-catalog.xml下载如下

链接:https://pan.baidu.com/s/1WMS1yjuOUPd3nnoaGzCKRg
提取码:wef0


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!