IntelliJ IDEA 创建maven项目速度很慢,甚至卡住不动了。
原因
IDEA根据maven archetype的本质,其实是执行mvn archetype:generate命令,该命令执行时,需要指定一个archetype-catalog.xml文件。
该命令的参数-DarchetypeCatalog,可选值为:remote,internal ,local等,用来指定archetype-catalog.xml文件从哪里获取。
remote——指向Maven中央仓库的Catalog
internal——maven-archetype-plugin内置的
local——本地的,位置为~/.m2/archetype-catalog.xml
默认为remote,即从 http://repo1.maven.org/maven2/archetype-catalog.xml路径下载archetype-catalog.xml文件。
http://repo1.maven.org/maven2/archetype-catalog.xml 文件约为3-4M,下载速度很慢,导致创建过程卡住。
解决方案一
在创建Maven项目时加上 archetypeCatalog=internal 参数,如下:



解决方案二
在maven的VM Options加上-DarchetypeCatalog=internal参数,如下:


|