解决maven生成项目时卡死

Intellij中maven使用maven-archetype-quickstart生成项目进,总是卡住,没有生成项目结构

解决maven生成项目时卡死_第1张图片
总是在这里阻塞
解决maven生成项目时卡死_第2张图片
项目结构没有生成

在maven命令窗口是这样的(mvn 加上-X参数可以查看debug启动信息)

解决maven生成项目时卡死_第3张图片
Paste_Image.png

搜索过程:

  • maven "Generating project in Batch mode"问题的解决
  • 在Intellij中应该这样解决(纠正一下:文章中internal应该修改成local)

总结:

  1. 主要原因就是网速问题(maven服务器在国外),因为配置文件无法下载造成阻塞 archetype-catalog.xml
  2. 解决方法就是下载这个配置文件,把文件archetype-catalog.xml复制到目录.m2\repository\org\apache\maven\archetype\archetype-catalog\2.3下面
  3. 在maven命令中增加参数-DarchetypeCatalog=local ,在本地读取这个文件就ok了

手动下载archetype-catalog.xml,加上参数后,项目马上生成ok

Paste_Image.png
解决maven生成项目时卡死_第4张图片
Paste_Image.png

2017-09-14 补充 :

  • 在intellij 中的设置: 返回到intellij主界面(没有打开项目时),点击configure, 在mavenrunner中增加参数 archetypeCatalog=local
解决maven生成项目时卡死_第5张图片
image.png
解决maven生成项目时卡死_第6张图片
image.png
image.png

你可能感兴趣的:(解决maven生成项目时卡死)