原因
IDEA 根据 maven archetype 的本质,其实是执行 mvn archetype:generate 命令,该命令执行时,需要指定一个 archetype-catalog.xml 文件.
该命令的参数 - DarchetypeCatalog,可选值为:remote,internal ,local 等,用来指定 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,下载速度很慢,导致创建过程卡住.
解决方法 1. 在下面界面添加一个属性, archetypeCatalog = internal
方法二
在 maven 的 VM Options 加上 - DarchetypeCatalog=internal 参数,如下:
方法 3: 用 local (推荐这种方法 完美)
1. 由于默认情况下,根据 archetype 创建 maven 项目会从网络下载 catalog 文件,导致创建 maven 项目缓慢
Searching for remote catalog: http://repo1.maven.org/maven2/archetype-catalog.xml
2. 解决办法可以设置使用本地 catalog 文件,在 IDEA 中设置 archetype 的使用方式为 local;
-DarchetypeCatalog=local
直接先把 文件用搜狗浏览器或其它下载工具下载下来.
下载后放到哪里呢,这里与本地仓库的位置有关,假如本地仓库是 maven 默认的,并没有修改 那么就需要放到 C:\Users\del-berlin\.m2\repository\org\apache\maven\archetype\archetype-catalog\2.4 \ 下 ,本地仓库的默认位置:Default: ${user.home}/.m2/repository
来源: http://www.bubuko.com/infodetail-2469873.html